Paste text or code and number every line. Set the start number, the step, the separator, and the padding. You can also switch to Remove numbers to strip line numbers from pasted code.
This tool runs entirely in your browser. What you enter is never sent anywhere.Your input is never sent anywhere.
DetailsCopy result copies the numbered text, with the numbers and the separator at the start of each line.
How the numbering works
The tool puts a number and a separator at the start of each line, such as 1: first line. You choose the start number, the step, the separator, and whether the numbers are padded with zeros or spaces so they line up.
Blank lines can be numbered, left unnumbered, or removed. The result shows in a code-style view and updates as you type, and Copy result gives you the numbered text.
It also works the other way. Switch to Remove numbers to strip line numbers from text or code that you copied with them.
When numbered lines help
Code review and bug reports
Point to line 42 in a message or a ticket. Number a snippet before you paste it so everyone refers to the same lines.
Drafts, scripts, and contracts
Number the lines of a draft so reviewers can say which line they mean. Start at any number to match a longer document.
Logs and data lists
Number rows and pad the numbers so the text lines up. A tab separator puts each number in its own spreadsheet column.
Code copied with line numbers
Some pages copy the numbers along with the code. Use Remove numbers to get clean code back.
How to number lines in 4 steps
- Paste your text into the Input text box.
- Choose Add numbers, or Remove numbers if the text already has line numbers.
- In the Numbering settings, set Start at, Count by, the separator, Align numbers, and how to handle blank lines.
- Check the Result, then click Copy result or Save.
Note: There is no run button. The result updates as you type and every time you change a setting. On a phone, open Numbering settings under the input box.
Details that affect the numbers
- Start and step: Start at accepts any whole number, including negative numbers. Count by must be 1 or more. An empty or invalid field falls back to 1.
- Padding width: it is set by the larger of the first and the last number, so every number in the result has the same width.
- Blank lines: a line with only spaces counts as blank. With Keep them, but do not number, a blank line does not use up a number.
- Line endings: Windows, old Mac, and Unix line endings are all handled, and a final line break does not get its own number.
- Remove numbers: numbered lists such as 1. Introduction are also stripped, because they look like line numbers. Check the preview before you copy.
Number format examples
Results for three lines: alpha, beta, and gamma. Each line is shown after a slash.
| Settings | Result | Good for |
|---|---|---|
| Start at 1, colon | 1: alpha / 2: beta / 3: gamma | Error reports and code review |
| Start at 151, period | 151. alpha / 152. beta / 153. gamma | Matching a section of a longer file |
| Start at 10, count by 10, parenthesis | 10) alpha / 20) beta / 30) gamma | Steps you may need to insert between later |
| Start at 99, zero padding | 099: alpha / 100: beta / 101: gamma | Logs and lists where the numbers should line up |
| Tab separator | 1⇥alpha / 2⇥beta / 3⇥gamma | Pasting into a spreadsheet, with the number in its own column |
| Blank lines: keep, do not number | 1: alpha / (blank line) / 2: beta | Numbering items but keeping the gaps between paragraphs |
Space padding and zero padding
Both give every number the same width. Zero padding writes 08 and 10, and space padding writes " 8" and "10". Space padding is easier to read in code and logs because the numbers right-align in a monospaced font.
Your text stays in your browser
The tool runs as JavaScript on the page and has no upload step, so private code and drafts are not sent to a server.
Line numbers in code reviews, logs, and documents
Three practical points that decide whether your line numbers are useful.
Matching the numbers in your editor or on GitHub
Code editors and code hosting sites number every line, including blank ones. To get the same numbers here, leave Blank lines on Number them.
If your snippet starts partway into a file, set Start at to the first line number of the snippet, so a reference to line 151 points to the same place in both.
Aligned numbers in logs and lists
When the numbers go from 9 to 10, the text shifts one column to the right and the list looks ragged. Space padding keeps the text in one column in a monospaced font, and zero padding does the same with leading zeros.
The width follows your longest number, so a list with more than 999 lines is padded to four digits without any change on your side.
Removing line numbers from pasted code
When a page copies line numbers with the code, Remove numbers strips them. The default rule takes off a number only when it is followed by a separator and a space, or by a tab, so values like 3.5 mg stay as they are.
If your numbers are followed by spaces only, turn on the single-space option, and check the result, because it can also remove numbers that are part of the text.
Common problems with line numbers
The numbers do not match the editor
A reviewer says line 42 and your numbered copy shows something else, because blank lines were skipped or removed.
💡 See the solution▼
The text does not line up after line 9
The numbers grow from one digit to two, so the text moves to the right and the log is hard to scan.
💡 See the solution▼
Real numbers are removed along with the line numbers
Remove numbers also strips a numbered heading such as 1. Introduction, because it looks like a line number.
💡 See the solution▼
Code loses its indentation
You copied code with line numbers, and the numbers are followed by spaces that were part of the indentation.
💡 See the solution▼
Line number tool FAQ
Q.Can I start numbering from a number other than 1?
A. Yes. Type any whole number in Start at, including 0 or a negative number, for example 151 to match a section of a longer file. Count by sets the step between numbers, so 10 gives 10, 20, 30. If a field is empty or not a number, the tool uses 1.
Q.What happens to blank lines?
A. Under Blank lines you can choose Number them, which counts blank lines like any other line and matches what most code editors show. Keep them, but do not number leaves the blank lines in place without a number and does not use up a number. Remove them deletes them first. A line with only spaces counts as blank.
Q.How do I make the numbers line up?
A. Use Align numbers. Zero padding gives 01, 02, 10, and Space padding gives ' 1', ' 2', '10' so that the text starts in the same column in a monospaced font. The width is set by the larger of the first and last numbers, so the padding adapts to the length of your text and never cuts a number off.
Q.Can I change the separator, or use a tab?
A. Yes. Choose a colon, period, parenthesis, pipe, dash, tab, space, or no separator, or pick Custom and type your own, such as ] or an arrow. A tab is useful if you plan to paste the result into a spreadsheet, because the number then lands in its own column.
Q.Does Copy result include the line numbers?
A. Yes. Copy result copies exactly what the Result panel shows, with the number and separator at the start of each line. Save downloads the same text as a .txt file. To get the text without numbers, copy it from the Input box instead.
Q.How do I remove line numbers from text?
A. Switch to Remove numbers and paste the text. The tool removes a number at the start of a line when it is followed by a colon, period, parenthesis, pipe, or closing bracket and a space, or when it is followed by a tab. It also handles (1) and [1]. Lines that begin with something else, such as 3.5 mg or 2026 results, are left alone. A summary shows how many lines had a number removed.
Q.Why are some numbers not removed from code I copied?
A. Some pages copy the line number and then only spaces before the code, such as 10 followed by spaces. The default setting does not treat that as a line number. Turn on Also remove a number followed by a single space or dash to remove it. It takes off the number and one space, so most of the original indentation stays. This setting can also remove numbers that belong to the text, so check the result.
Q.Does it handle Windows line endings and a final line break?
A. Yes. Windows (CRLF), old Mac (CR), and Unix (LF) line endings are all read as line breaks. A line break at the very end of the text does not get its own number.
Q.Is there a limit on how many lines I can number?
A. The tool sets no line limit. It runs in your browser and uses your device's memory, and the result updates each time you change the text or a setting, so a very large paste can feel slower on an older device. Numbers can be up to 1,000,000,000 in size.
Q.Is my text sent to a server?
A. No. The tool numbers your text with JavaScript in your browser, and the page has no upload step. Your text is held only in the page while it is open, and closing or reloading the page clears it.
Your feedback
makes this tool better.
Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.