Add line numbers to any text
This tool adds line numbers to text: paste a list, a poem, a script, a log or a block of code and every line gets a number at its start. Numbered lines are easier to discuss (“see line 14”), to turn into a numbered list for a document or e-mail, or to cite in a review. The result updates as you type or change an option.
Example
Preheat the oven to 200 °C.
Mix flour, salt and baking powder.
Stir in the milk.
With the format 1. text and Keep, no number for empty lines, you get:
1. Preheat the oven to 200 °C.
2. Mix flour, salt and baking powder.
3. Stir in the milk.
Options explained
- Start at: the first number, such as 1, 0 or 101 to continue an earlier list. Negative numbers work too.
- Step: how much each number grows: 1 for 1, 2, 3; 10 for 10, 20, 30, as in old BASIC listings.
- Format: the text between the number and the line:
1.,1),1:,1 -,1 |, a tab (handy for pasting into a spreadsheet, where the numbers land in their own column), a single space, or your own custom separator. - Padding: Zeros gives 01, 02 … 10 so the numbers sort correctly as text; Spaces right-aligns them ( 9, 10) so the text after them lines up in a monospace font. The width follows the largest number.
- Empty lines: Number them counts every line, which matches the line numbers in a code editor; Keep, no number leaves blank lines in place without using up a number; Remove them deletes blank lines before numbering. Lines holding only spaces count as empty.
Removing line numbers
The Remove numbers button does the opposite: it takes the number and its separator off the start of each line. It recognises the formats above (“1. ”, “01) ”, “ 3: ”, “4 - ”, “5 | ” and a number followed by a tab), so a number that is part of the sentence, as in “2026 was a good year”, stays. Use it to clean code copied from a web page or a PDF that included line numbers.
Line endings and the last line
Windows (CRLF) line endings are kept as they are, so the result pastes back into the same file type. If your text ends with a line break, that final break is kept and does not receive a number of its own. Long lines are numbered once, however they wrap on screen, because numbering follows the actual line breaks.
When to use other tools
To put the same text before or after every line rather than a number – quotes, bullets or HTML tags – use Text Replacer with a regular expression. To clean up first, Remove Empty Lines deletes blank lines and Sort Text Lines puts the lines in order before you number them. The numbering runs in your browser and your text is not uploaded.