Summary: add line numbers to text, free and private
To add line numbers to text for free and without uploading anything, paste it into the box above or open a text file. The numbered version appears underneath as you type, and the Copy and Download .txt buttons save it. The numbering happens in your browser, and the Network tab in your browser's DevTools shows that no request is sent.
A line-numbering tool puts a running number at the start of each line. To count lines rather than number them, use the line counter; for removal only there is a separate remove line numbers page.
Table of Use: settings and what you get
Each row shows the text pasted in, the settings changed from their defaults and the result. ↵ marks a line break and ⇥ a tab.
| Task | Input | Settings | Result |
|---|---|---|---|
| Number a snippet or list | alpha↵beta↵gamma | Defaults: Start Number 1, Increment 1, Colon | 1: alpha↵2: beta↵3: gamma |
| Count down | Same three lines | Start Number 10, Increment -1 | 10: alpha↵9: beta↵8: gamma |
| Keep numbers the same width | 12 lines | Number width: Pad with zeros | 01: …↵09: …↵10: …↵12: … |
| Split into spreadsheet columns | Same three lines | Separator: Tab (the default suffix space is cleared) | 1⇥alpha↵2⇥beta↵3⇥gamma |
| Make a Markdown numbered list | Same three lines | Separator: Period | 1. alpha↵2. beta↵3. gamma |
| Number paragraphs, not blank lines | alpha↵↵beta | Skip empty lines ticked | 1: alpha↵↵2: beta |
| Strip numbers from a listing | 1: alpha↵2: beta | Remove line numbers, Separator: Colon | alpha↵beta |
Features
- Start Number and Increment. Any whole number, including 0 and negatives. Decimals and numbers past 9,007,199,254,740,991 get an error message.
- Five separators. Colon, Comma, Period, Pipe or Tab sits between the number and the text.
- Prefix and Suffix. Add text before the number or after the separator. The suffix starts as one space; clear it to get
1:text. - Number width. Leave numbers as they are, pad them with zeros to the width of the largest, or right-align them with spaces. When you pad, negative and positive numbers keep the same width.
- Skip empty lines. Blank and whitespace-only lines are left unnumbered and the count continues on the next line with text.
- Remove line numbers and Swap. Removal uses the separator, prefix and suffix you have set. Swap sends the result back in as the input and flips the mode.
Numbers stay attached to their lines, so remove empty lines, remove duplicate lines or sort the lines alphabetically first.
How to Use the Line Numbering Tool
- Type or paste your text into the box labelled "Text to number", or click Choose File to open a text file.
- Read the result under "Numbered Text". It updates whenever you change the text or a setting.
- Set Start Number, Increment, Separator, Prefix/Suffix, Number width and Skip empty lines as needed.
- Click Copy, or Download .txt to save the numbered text. Click Reset to start again.
- To undo numbering, click Remove line numbers (or Swap) and make sure the separator, prefix and suffix match.
Who Can Use It
Developers number snippets and log excerpts so a colleague can quote "line 14", then compare versions in the text diff tool. Teachers and students number poems and exercises, and spreadsheet users pick Tab to get a row-number column.
Writers can polish numbered lists in the Markdown editor and check length with the word counter or character counter. Find and replace and the text case converter tidy a copied listing.
FAQs
How do I add line numbers to text online for free?
Paste your text into the box labelled "Text to number" and the numbered version appears below it, as "1: first line", "2: second line" and so on. Change the start number, increment, separator, prefix or number width if you want another style, then click Copy or Download .txt. No sign-up is needed.
How do I add line numbers to a text file?
Click Choose File under "Or open a text file" and pick a text-based file such as .txt, .md, .csv, .log, .json, .js or .py. Your browser reads it locally. Set the numbering, then click Download .txt to save numbered-lines.txt. The download is always a .txt file, so rename it if you need the original extension.
Can I start line numbers at 0, or count down?
Yes. Start Number and Increment each accept any whole number, including 0 and negative numbers. Start at 0 with an increment of 1 for zero-based numbering, or start at 10 with an increment of -1 for a countdown of 10, 9, 8 and so on. Decimals such as 0.5 are not accepted.
How do I add leading zeros to line numbers?
Open the Number width menu and choose "Pad with zeros (01, 02 … 10)". Every number is padded to the width of the largest one, so 12 lines get 01 to 12 and 100 lines get 001 to 100. "Right-align with spaces" pads with spaces instead, which suits reading in a monospaced font.
How do I remove line numbers from text?
Click "Remove line numbers", paste the numbered text and pick the separator it uses, plus the prefix if there is one. The tool deletes the number, separator and suffix from the start of each line and leaves other lines alone. After numbering some text, Swap moves the result into the input and switches mode.
Is it safe to add line numbers to code or private documents online?
Yes. The numbering runs in JavaScript in your browser and a file you open is read locally, so nothing is uploaded. Open the Network tab in your browser's DevTools and you will see no request when you paste text or change a setting. Nothing is stored either, so reloading the page clears the text.