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.
More Text & Writing Tools
View all 28Removing 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
- Paste your text.
- Set the start, step, format and padding.
- Tick Do not number empty lines if blank lines should be skipped.
- 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
Explore More Tools
Keep going with related categories and our most used tools.