Add Line Numbers
Prefix every line with its line number. Configurable start value, separator, and zero-padding.
About Add Line Numbers
This tool prepends each line with a sequential number. You can choose the starting number, the separator between number and content, and whether to zero-pad the numbers so they all align to the same width.
When to use it
- Producing a numbered list for documentation
- Adding 'cat -n' style line numbers to a code snippet
- Preparing a numbered transcript or step-by-step guide
- Adding row identifiers to a printed list
How it works
Lines are split on LF/CRLF. Each line is prepended with its index (offset by the configured start value) followed by the separator. Zero-padding aligns all numbers to the width of the largest one.
Examples
Start=1, separator=': '
foo bar baz
1: foo 2: bar 3: baz
Frequently asked questions
- Can I start from 0?
- Yes — set the start value to 0. Negative starts are also supported.
- What separator should I use?
- Common choices: ': ' for readable lists, '. ' for ordered lists, '\t' for tab-separated data. The default is ': '.
- Are blank lines numbered?
- Yes — each line gets a number regardless of whether it has content. Remove blank lines first if you want them skipped.