Line numbers turn vague feedback into precise feedback. "The second bullet in the middle section" becomes "line 14". Editors, lawyers, teachers, script supervisors and developers all rely on them because they let several people point at exactly the same place without screenshots or long quotes.
This guide covers when numbering is worth doing, which format suits which job, and how to number any block of text quickly, whether it is a checklist, a transcript, a set of survey answers or a snippet of code. It also shows how to do it in Word, a spreadsheet and the command line.
Why number lines at all?
Numbering serves a few distinct purposes, and the purpose decides the format:
| Purpose | Typical format | Notes |
|---|---|---|
| Reviewing a draft or contract | 1. or 1: |
Readers cite "line 23" in comments |
| Step-by-step instructions | 1. or 1) |
Numbers imply order, so only use for sequences |
| Transcripts and interviews | [1] or 001 |
Brackets separate numbers from spoken text |
| Code snippets in documents | 1 | or a tab |
Keeps columns aligned in a monospaced font |
| Importing into a spreadsheet | 1<tab> |
Tab-separated numbers land in their own column |
There is also a difference between numbering lines and numbering items. A contract reviewer wants every physical line counted, including blank ones, so line references stay stable. A recipe or checklist wants only real items numbered, with blank lines left as visual gaps.
Start values, steps and padding
Three settings cover almost every numbering need.
Start value. You rarely need anything other than 1, but continuing a list from a previous page (start at 41), or matching a document that begins at 0, is common.
Step. A step of 10 (10, 20, 30…) is an old trick from programming and legal drafting: it leaves room to insert new lines later, such as 15, without renumbering everything.
Zero padding. Padding adds leading zeros so all numbers have the same width: 01 to 12, or 001 to 120. It keeps text aligned in a monospaced font, and it makes file names and exported rows sort correctly, because without padding a plain text sort puts 10 before 2.
Add line numbers in your browser
Our Add Line Numbers tool gives you all of these options and processes the text on your device.
- Open Add Line Numbers and paste your text into Your text, or click Sample to try it.
- Pick a Number format:
1. Line,1) Line,1: Line,1 - Line,[1] Line,1 | Line,1<tab>Line, or Custom pattern…. - For a custom format, type a pattern using
{n}for the number, for exampleLine {n}:orQ{n}. - Set Start at and Step. Start accepts negative numbers too.
- Turn on Pad with zeros to make every number the same width.
- Decide on Skip empty lines. When it is on, blank lines stay in place but get no number; when it is off, every line, blank or not, is counted.
- Copy the result from Numbered lines, or click Download to save it as a text file.
The output is shown in a monospaced font so you can check alignment before copying.
Other ways to add line numbers
Microsoft Word
Word has a genuine line-numbering feature under the Layout tab (look for Line Numbers). It numbers lines in the margin, restarts per page or section if you want, and the numbers are not part of the text, so they do not get in the way of editing. For legal drafts that stay in Word, this is usually the better option. The limitation is that the numbers disappear the moment you copy the text elsewhere.
Word's Numbering button in the Home tab is different: it creates a numbered list of paragraphs, which is fine for steps but not for referencing physical lines.
Spreadsheets
Paste the lines into column B of Excel or Google Sheets, type 1 in A1 and 2 in A2, select both and drag the fill handle down. To combine them into one text column, use a formula such as =A1&". "&B1. Spreadsheets are handy when you also want to sort or filter the lines afterwards, and Sort Lines can do the sorting part without a spreadsheet.
Command line
On macOS and Linux, nl numbers lines and skips blank ones by default:
nl -w3 -s'. ' notes.txt
cat -n notes.txt numbers every line including blanks. Both are ideal for batches of files but offer fewer format options.
Code editors
Most code editors show line numbers in the gutter, but those numbers are not copied with the text. If you need numbers inside the text, for a document or an email, you must add them as characters, which is what a numbering tool does.
Tips and pitfalls
Numbers shift after editing
If numbered text will keep changing, add numbers as the very last step. Otherwise inserting one line forces you to renumber everything, and comments that refer to "line 30" point at the wrong place. Using a step of 10 reduces this problem.
Existing numbers in the text
If your lines already start with numbers or bullets, you will end up with 1. 1. Buy paper. Strip the old markers first. Find and Replace with a regular expression such as ^\d+\.\s* removes them.
Blank lines and references
For documents that other people will cite, turn Skip empty lines off so every line has a stable number. For checklists and instructions, keep it on so only real items are counted.
Pasting into apps that auto-format
Word, Google Docs and some email clients detect 1. at the start of a line and convert the text into an automatic list, which can renumber or reindent. Pasting as plain text, or using a format like [1] or 1 |, avoids this.
Adding text other than numbers
If you want to add the same text to every line rather than a counter, such as a bullet or a file extension, Add Prefix & Suffix to Lines is the better fit. It also supports {n} for numbered prefixes.
Frequently asked questions
How do I number lines but skip blank ones?
Turn on Skip empty lines. Blank lines remain in the output for spacing but receive no number, so the count continues on the next line with text.
Can I start numbering from a number other than 1?
Yes. Enter any value in Start at, including zero or a negative number, and set Step to count in twos, tens or any other interval.
What is zero padding and when should I use it?
Zero padding adds leading zeros so all numbers have the same width, such as 01 to 99. Use it when alignment matters or when the numbered lines will be sorted as text.
Can I add line numbers in Word without typing them?
Yes. Word's Line Numbers option in the Layout tab numbers lines in the margin. Those numbers stay in Word, though, and are not copied with the text.
Will line numbers be copied into other apps?
Numbers added by our tool are part of the text, so they copy anywhere. Numbers shown by editors or Word's margin feature are display-only and do not copy.