Text

Add Line Numbers to Text

Adds a number to the front of every line, starting wherever you like, with optional zero padding.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste the block of text you want to number.
  2. Set the starting number to the real first line if you are quoting from the middle of a file.
  3. Select Number lines and paste the result wherever the conversation is happening.

What line numberer does

Numbered lines exist to be pointed at. The moment two people are looking at the same block of text in different windows, "the third one from the bottom" stops working and "line 47" starts. Pasting a numbered copy into a ticket, a review comment or a chat message removes an entire round of confusion.

The start number is settable because the block you are quoting rarely begins at the top of its file — set it to the real first line and the numbers match the source. Zero padding keeps the text aligned when the count crosses from single to double digits, and blank lines can be skipped so they do not consume numbers.

Frequently asked questions

Yes, and you usually should. If you are quoting lines 47 to 61 of a file, set the start to 47 and the numbers in your quote match the numbers the other person sees in their editor.

Alignment. Without it the text shifts by a character when the count goes from 9 to 10, and by another at 100. Padding keeps every line starting in the same column, which matters when the numbered block is code.

Use the find and replace tool in regular expression mode with a pattern such as ^\d+:\s* and an empty replacement. That removes the numbering from the start of every line and leaves the text as it was.