TextToolboxTextToolbox

Add Line Numbers

Number physical text lines with six prefix styles, a validated start and step, optional blank-line skipping and TXT export.

Built by Saurabh Kumar

Quick Answer

Add sequential prefixes to CRLF, LF or CR text lines. Choose six styles and a nonnegative start with a positive step. Blank-line skipping, trailing empty lines and safe-integer limits are explicit. This does not parse CSV records or code.

Numbering Options

Format

CRLF, LF and CR separators in the input value are preserved. A final separator creates a final empty line. Browser paste and Copy may normalize endings.

Input Text

0 lines

Numbered Output

What Is Add Line Numbers?

Prefix physical text lines with a sequence starting at a nonnegative whole number. Choose six prefix styles, a positive step and whether whitespace-only lines should stay unnumbered. This is a text-line formatter, not a parser for code, CSV records or spreadsheet cells.

How to Use Add Line Numbers

  1. Paste text or load Sample.
  2. Choose Plain, Zero-padded, Dot suffix, Colon suffix, Bracket or Tab separator.
  3. Choose a preset start, or Custom for a whole number from 0 to 9007199254740991. Step must be a whole number from 1 to the same maximum.
  4. Enable Skip empty lines if blank and whitespace-only lines should pass through without advancing the sequence.
  5. Review the entire output, then Copy or Download TXT. Select the output manually if Copy fails.

How Add Line Numbers Works

CRLF, LF and lone CR split the input value into lines; their original separators are retained. Empty input has zero lines. A trailing separator creates a final empty line, which receives a number unless Skip empty lines is enabled. Browser input/clipboard handling can normalize those endings.

The last numbered value is checked before output is generated. Start, step and every result must stay within JavaScript's safe integer range. Integer arithmetic prevents overflow from being silently rounded. Zero-padded width follows the last assigned number, so a three-line sequence ending at 3 uses one digit, not 001.

Add Line Numbers Example

Input A, an empty line and B, with start 8, step 2 and Skip empty lines enabled, produces 08 A, the unchanged empty line and 10 B in Zero-padded mode.

08 A

10 B
Prefix styles for the first numbered line A in a sequence ending at 10
StyleOutput, start 8
Plain8 A
Zero-padded08 A
Dot suffix8. A
Colon suffix8: A
Bracket[8] A
Tab separator8, one literal tab, then A

When to Use Add Line Numbers

Review references

Number a plain-text snippet so someone can refer to a particular physical line.

Continued checklists

Start a new section at the next number in an existing list.

Spaced sequences

Use steps of 5 or 10 to leave gaps for later manual insertion.

Common Mistakes

Negative, fractional, empty or exponent-form numeric settings are rejected. An oversized last number blocks the whole result. Input is limited to 1,000,000 UTF-16 units and 20,000 lines; output cannot exceed 5,000,000 units. There is no partially numbered export on error.

Existing bullets, tabs and numbers are kept after the prefix. Numbering code changes its source; keep a runnable original. Tab mode does not quote spreadsheet fields, and multiline CSV records are not physical lines. A final newline or skipped blanks can make these numbers differ from your editor's line references.

Tips for Better Results

Decide whether blank lines should consume numbers before sharing a reference list. Compare the first and last values, especially for Custom starts. Use Add Prefix/Suffix for a fixed label rather than a sequence. If Download fails, the output remains available for Copy or manual selection.

Share This Tool

Share this free online line numbering tool with your team or fellow developers!