How to Add Line Numbers to Text Online
To add line numbers to text online, paste your text into a free browser tool, pick a separator like 1. or 1:, and copy the numbered result back. It takes under a minute, with nothing to install and no file to upload. Below, I will walk you through the online method step by step, then show you how to get the same result in Microsoft Word, Google Docs, Notepad++, and VS Code, so you can pick the route that fits whatever you are working on.
Numbered lines are a small change that makes a big difference. In a code review, “fix line 47” beats “fix the third paragraph down” every time. In a script or transcript, numbers let everyone point at the same line, and in a long list they make it obvious when an item is missing. The thing to get right is which kind of numbering you need, because margin numbers that only show on screen and numbers baked into the text behave very differently once you copy, paste, or print.
Key takeaways
- Paste your text into a browser tool and every line gets a sequential number in one click.
- Decide up front whether blank lines get numbers or are skipped, because it changes every number after the first gap.
- “1.” is the safest separator for documents, while a tab works best for spreadsheets and code.
- Word adds margin numbers that do not change your text, while browser tools bake the numbers into the text itself.
- Always re-check your numbering after pasting into another app, since some apps renumber or strip it.
How to Add Line Numbers to Text Online
The fastest route is a browser tool that runs entirely on the page. Nothing is installed, and with a client-side tool your text never has to leave your device. Here is the full process:
- Paste your text. Copy the lines from your document, spreadsheet, or code file and paste them into the tool’s input box. Each line break in your text becomes one numbered line.
- Set the starting number. Most tools start at 1. If you are continuing a list, or numbering lines from the middle of a document, change the start value first — for example, start at 48 to continue a 47-line section.
- Pick a separator. This is the character (or characters) placed between the number and the text. “1.” is the default for most people, but the right choice depends on where the text is going, as the comparison table below shows.
- Choose how blank lines are handled. You can number every line including blanks, or skip blanks so only lines with content get a number. Skipping blanks keeps numbered lists tidy, but numbering blanks preserves the exact line positions of the original text, which matters for code and transcripts.
- Generate and copy. Click the tool’s numbering button, scan the first and last few lines to confirm the count looks right, then copy the result and paste it wherever you need it.
Before you number a messy list, it is worth cleaning it first. If your text has stray blank lines, removing the empty lines before numbering keeps the sequence tight, and removing extra spaces stops double spaces from making the numbered output look ragged.
Number Every Line or Skip the Blanks?
This is the one setting people get wrong most often, and it changes the meaning of the numbers. Consider a short script:
INTRO HOST: Welcome back. HOST: Today we rank the top five.
If you number every line, the blank line becomes line 3, and “HOST: Today we rank the top five” becomes line 4. If you skip blanks, that same sentence becomes line 3. Neither answer is wrong, but they disagree with each other, and anyone referencing “line 3” needs to know which rule you used.
As a rule of thumb: number every line when the numbers must match positions in the original file, such as code, logs, or a transcript under review. Skip blanks when you are producing a clean numbered list for readers, where a blank line is just spacing and should not consume a number.
Separator Styles Compared
The separator is a small detail that decides whether your numbered text survives the next paste intact. This table covers the common options:
| Separator | Example | Best for |
|---|---|---|
| Period and space (1.) | 1. Apple | Documents, lists, email, and anything a human will read |
| Parenthesis (1)) | 1) Apple | Legal-style lists and outlines |
| Colon (1:) | 1: Apple | Scripts, transcripts, and chat logs |
| Tab | 1 Apple | Spreadsheets and code, where the number should sit in its own column |
| Zero-padded (001.) | 001. Apple | Long lists that must still sort in the right order as plain text |
Two practical notes. First, a period separator can confuse apps that auto-detect numbered lists: pasting “1. Apple” into Word or Google Docs may trigger their own list formatting and renumber your lines. Pasting as plain text avoids that. Second, zero-padding matters more than people expect: without it, a plain-text sort puts line 10 before line 2, because “1” comes before “2” alphabetically. If you plan to sort lines alphabetically after numbering, pad the numbers first.
How to Add Line Numbers in Microsoft Word
Word’s line numbering is display-only: numbers appear in the left margin but are not part of your text, so they will not be copied if you paste the text elsewhere. That is exactly what you want for a document under review, and exactly what you do not want if you need the numbers to travel with the text.
- Open the Layout tab on the ribbon.
- Click Line Numbers in the Page Setup group.
- Choose Continuous to number the whole document, Restart Each Page to restart on every page, or Restart Each Section to restart after each section break.
- For finer control, choose Line Numbering Options, then set the starting number and the “Count by” interval — for example, count by 5 to show a number only on every fifth line.
- To remove numbering, return to Line Numbers and choose None.
Microsoft’s own documentation covers these numbering options in more detail, including how the start-at and count-by settings interact (see Microsoft Learn: line numbering in Word). One Word quirk to know: line numbers only appear in Print Layout view, not in Web Layout or Draft view, so if you turn them on and see nothing, switch views before assuming they failed.
How to Add Line Numbers in Google Docs
Google Docs has no built-in margin line numbering like Word, so the honest answer is a workaround. For a short list, use Docs’ own numbered list: select the lines, then click the numbered-list button or press the list shortcut. That gives you clean “1. 2. 3.” formatting that Docs manages for you, including automatic renumbering when you insert a line in the middle.
For longer or pre-existing text, the more reliable route is to number the text in a browser tool first, then paste it into Docs as plain text (Ctrl+Shift+V on Windows, Cmd+Shift+V on Mac). Pasting as plain text keeps Docs from converting your numbers into its own list and renumbering them. If you paste normally and Docs does take over, undo once and retry with plain-text paste.
How to Add Line Numbers in Notepad++ and VS Code
Notepad++ can bake numbers directly into your text with its Column Editor. Place your cursor at the start of the first line, hold Alt+Shift and drag down (or use Alt+Shift+arrow keys) to select a zero-width column across all lines, then open Edit > Column Editor, choose Number to Insert, set the initial value and step, and click OK. Every selected line gets its number inserted at the cursor position, and you can follow it with a separator by repeating the process with a character insert, or by including the separator in a second pass.
VS Code is different: it shows line numbers in the left gutter by default, but those numbers are not part of your file and will not appear when you copy the text. To bake numbers into a file in VS Code, use the integrated terminal and a command-line tool such as nl (for example, nl -ba file.txt numbers every line), or install a numbering extension. Do not assume gutter numbers will survive a copy — they never do.
5 Mistakes That Break Line Numbering
- Counting wrapped lines as lines. A long sentence that wraps across two display rows is still one line to a numbering tool, because tools count line breaks, not screen rows. If your numbers look “off,” check for wrapped lines first.
- Numbering before cleaning. Blank lines, trailing spaces, and duplicate lines all get numbers too. Clean first, number second.
- Leaving a trailing newline. Text that ends with an extra blank line often produces a phantom final number with nothing after it. Delete the trailing blank line before numbering.
- Numbering twice. Running already-numbered text through a tool again gives you “1. 1. Apple.” Always work from the unnumbered original.
- Numbering before sorting. If you sort numbered lines, the numbers travel with their lines and the sequence scrambles. Sort first, then number — or re-number after sorting.
Questions People Ask About Adding Line Numbers
How do I add line numbers to text online for free?
Paste your text into a free browser-based line-numbering tool, pick a separator and a blank-line rule, and copy the result. No sign-up or install is needed, and the whole process takes under a minute for a typical list or document.
Should empty lines be numbered?
Number them when the numbers must match the original file’s line positions, as with code, logs, or transcripts under review. Skip them when you are making a clean numbered list for readers, where blank lines are only spacing and should not consume a number.
What separator should I use for line numbers?
Use “1.” for documents and lists people will read, a tab when the numbers need their own column in a spreadsheet or code file, and zero-padded numbers like “001.” for long lists that must sort correctly as plain text.
Can I add line numbers in Google Docs?
Not as margin numbers the way Word does it. Use Docs’ numbered list for short lists, or number your text in a browser tool first and paste it into Docs as plain text so Docs does not renumber it.
Frequently Asked Questions
Do line numbers change my original text?
It depends on the method. Browser tools and Notepad++’s Column Editor insert the numbers into the text itself, so the numbers become part of what you copy. Word’s and VS Code’s gutter numbers are display-only and never change your text.
How do I remove line numbers later?
If the numbers are baked into the text, remove them with a regular expression: find ^\d+[.\)]\s* and replace with nothing in any editor that supports regex find-and-replace. If the numbers are Word margin numbers, set Line Numbers back to None.
Can I start numbering at 0 or 100?
Yes, in most browser tools and in Notepad++’s Column Editor you can set any starting value, including 0 or 100. Word also lets you set a custom starting number through its Line Numbering Options dialog.
Why do my numbers restart after pasting into Word?
Word detected your “1.” lines as its own numbered list and took over the numbering. Undo, then paste as plain text instead, and Word will leave your numbers exactly as they are.
Is it safe to paste private text into an online numbering tool?
Prefer tools that run entirely in your browser, where the page itself states that nothing is uploaded or stored. If a tool requires uploading a file to a server, do not use it for private, legal, or client text — use Notepad++ or the nl command locally instead.
The Bottom Line
Adding line numbers to text online is a one-minute job once you know the two decisions that matter: whether blank lines get numbers, and which separator fits where the text is going next. For a quick list, a browser tool is the fastest route. For a document under review, Word’s margin numbers are the right call because they never touch your text. And for code or files that must keep their numbers wherever they travel, bake the numbers in with Notepad++, nl, or a browser tool — then paste as plain text so no app renumbers your work.
