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
- Paste text or load Sample.
- Choose Plain, Zero-padded, Dot suffix, Colon suffix, Bracket or Tab separator.
- 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.
- Enable Skip empty lines if blank and whitespace-only lines should pass through without advancing the sequence.
- 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
| Style | Output, start 8 |
|---|---|
| Plain | 8 A |
| Zero-padded | 08 A |
| Dot suffix | 8. A |
| Colon suffix | 8: A |
| Bracket | [8] A |
| Tab separator | 8, 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!