This tool lets you add line numbers to text in a second, with your own starting number, step, separator and padding. It can also strip old numbers from code or lists you have copied from somewhere else. Writers, teachers, programmers and legal reviewers use it to cite exact lines in feedback, transcripts and code reviews.
-
Runs entirely in your browser — nothing is uploaded. If you leave Start at or Step blank, the tool uses 1.
How to Add Line Numbers to Text
The tool splits your text at each line break and writes a counter in front of every line. You choose the start, the step, the separator and whether short numbers get padded so the text lines up. Remove numbers works in reverse.
Formula: number for the k-th numbered line = start + step × (k − 1), where k counts from 1. Padding width = digits in the last number; zeros or spaces are added on the left until each number reaches that width. Output line = padded number + separator + original line. Remove mode deletes optional spaces, then digits, then one of . ) : | – or a tab, then at most one space. Lines like 3 apples, with no separator, are left alone.
- Mode — Add numbers or Remove numbers.
- Your text — any plain text, code or list.
- Start at — the first number, 0 or higher. Step — the increase per line, 1 or higher. If you leave either box blank, the tool uses 1.
- Separator — dot, bracket, colon, dash, pipe, tab or a single space.
- Padding — none, leading zeros, or spaces for right-aligned numbers.
- Skip blank lines — keeps empty lines empty and does not count them.
Example Scenarios
| Input | Settings | Output | Last number |
|---|---|---|---|
| 4 lines, line 3 blank | Start 1, step 1, dot | 1. Preheat the oven … 3. 4. Bake for 25 minutes | 4 |
| Same 4 lines | As above, skip blank lines | 1. 2. (blank) 3. Bake for 25 minutes | 3 |
| 12 lines | Start 1, leading zeros | 01. to 12. | 12 |
| PRINT A, GOTO 10 | Start 10, step 10, tab | 10[tab]PRINT A, 20[tab]GOTO 10 | 20 |
| 10 lines | Start 1, bracket, spaces | 1) to 10) | 10 |
1. alpha, 2) beta, 3[tab]gamma | Remove numbers | alpha, beta, gamma (3 removed) | – |
Tips for Using a Line Numbering Tool
Decide first whether blank lines should count. Code reviews and legal transcripts number every physical line, so line 48 means the same spot for everyone. Poems, recipes and checklists usually look better when empty lines stay unnumbered, which is what Skip blank lines does.
- To add numbers to list items for a document, the dot or bracket separator gives a familiar 1. or 1) look.
- Pick the tab separator if you plan to paste into a spreadsheet; the numbers land in one column and the text in the next.
- Use leading zeros when the numbered lines will be sorted as text, because 10 sorts before 2 without them.
- Before you remove line numbers from text, check lines that begin with a quantity, such as 2. Stir. Those look like numbered lines and lose their number.
Many people number lines online for a quick review and then add line numbers to text files they share later, so the Download button saves a plain .txt copy. Line numbers have a long history in programming, from BASIC to compiler errors, as Wikipedia’s line number article explains.
Add Line Numbers to Text FAQ
Is this numbering tool free, and does it work offline?
Yes. You can add line numbers to text here for free, with no line limit you are likely to hit. Everything runs in your browser, so once the page has loaded it keeps working without a connection, and nothing you paste is uploaded. That makes it suitable for contracts, student work or proprietary source code.Can I add line numbers to text in a textarea on my website?
A standard HTML textarea has no built-in line-number option. Sites usually place a narrow column of numbers beside it and keep the two scrolled together with a little JavaScript, or use a code editor component. If you only need numbered output, number the text here and paste the result in.Does TextEdit on a Mac show line numbers?
TextEdit does not offer a line-number gutter. You can paste your text here, number it, and paste it back into TextEdit, or open the file in a code editor that shows numbers in the margin. Numbers added here become part of the text itself.How do I add line numbers to a text file?
Open the file, select all, copy and paste it into the box above. Choose your settings, then press Download .txt to save a numbered copy with a new name. Tens of thousands of lines are usually fine, and Remove mode reverses it later.Can the tool remove line numbers instead?
Yes. Switch to Remove numbers and it strips a leading number plus a separator such as a dot, bracket, colon, pipe, dash or tab from each line. Lines without that pattern are untouched. The stats show how many numbers were removed so you can spot anything that was missed.Can I start from a number other than 1?
Yes. Set Start at to any whole number from 0 upwards, and Step to the gap between lines; a blank box counts as 1. Start 101 continues numbering from an earlier page, while start 10 with step 10 reproduces old BASIC listings. The last number shown in the stats tells you where to continue next time.Related Tools
For formal outlines, the Roman numeral converter for outline numbering turns 14 into XIV. The reading time calculator for long documents estimates how long a numbered script takes to read aloud, and the binary to decimal converter for programmers helps when the numbered text is code. Bookmark this page to add line numbers to text whenever you need it.