Skip to main content
Text & Writing Tools

Add Line Numbers

Add line numbers to text or code with your own start, step, format and zero padding - or strip existing numbers off.

Paste text or code and every line is numbered as you type.

Removing numbers strips a number at the very start of each line, so check lines that begin with a real number, such as a year.

What Does Add Line Numbers Do?

It puts a number in front of every line of your text or code. You choose where numbering starts, the step between numbers, the format (such as 1., 1) or 1 |) and whether to pad numbers with zeros so they line up. It can also strip numbers off text that already has them.

When It Helps

  • Sharing code in an email or chat so people can refer to "line 12".
  • Numbering the lines of a poem, script or legal text for review.
  • Turning a plain list into a numbered list.
  • Removing line numbers from code copied out of a book or a web page.

How to Use It

  1. Paste your text.
  2. Set the start, step, format and padding.
  3. Tick Do not number empty lines if blank lines should be skipped.
  4. Copy the result, or click Remove Line Numbers to do the opposite.

Example

A four-line PHP snippet numbered with the 1 | text format becomes 1 | <?php, 2 | , 3 | echo 'Hello'; and 4 | echo 'World';. With 100 or more lines and zero padding, numbers are written as 001, 002 and so on, so the code stays aligned.

Removing Numbers

Remove Line Numbers strips a number at the very start of each line, together with a following dot, bracket, colon, pipe or tab - the formats this tool and most code viewers produce.

Limitations

Removing numbers cannot tell a line number from a number that really starts the line, such as 2026 was a good year, so check the result. The tool adds plain text, not formatting, so pasted rich text loses its styles. To count lines of code, use the Code Line Counter; to sort the lines first, use Sort Lines.

Frequently Asked Questions

Yes. Set Start at to any number, including 0, and set Step to count by 2, 5, 10 or any other amount.

Choose Zeros under Padding. Numbers are padded to the width of the largest number, so 100 lines are numbered 001 to 100.

Paste the code and click Remove Line Numbers. A number at the start of each line is removed, together with a dot, bracket, colon, pipe or tab after it.

Yes. Tick "Do not number empty lines" and blank lines keep their place but are skipped in the numbering.
Share this tool: