Add Line Numbers
Add line numbers at the start of each line
What Is the Add Line Numbers Tool?
The Add Line Numbers tool takes any block of text and prepends a number to the beginning of each line, starting from 1. It is the kind of thing that sounds almost too small to need a dedicated tool, but when you actually need it, doing it manually is tedious enough to be genuinely irksome. The tool is useful for anyone working with code snippets, scripts, lists, or any text where being able to reference a specific line by number makes communication faster.
Teachers, developers, and editors tend to reach for it most. Though honestly, it comes up in more contexts than you would expect.
How to Use This Tool
- Paste or type your text into the input box above.
- Check that your text has line breaks where you want the numbers to appear. Each new line gets its own number.
- Click the Add Line Numbers button and the tool rewrites your text with a number at the start of every line.
- Copy the result using the Copy button, or select and copy manually.
When Would You Use This?
- Adding line numbers to a code snippet before sharing it in a forum post, pull request comment, or email so reviewers can reference specific lines.
- Numbering steps in a procedure or instruction list when the original content came in as plain text without any formatting.
- Preparing a script, transcript, or document for review where annotators or editors need to call out exact lines by number.
Also used in education, for things like handing out a poem or a passage for class discussion where students need to point to specific lines. Line numbers make that kind of back-and-forth much less messy.
Frequently Asked Questions
How do I add line numbers to text?
Paste your text into the input box at the top of this page and click the Add Line Numbers button. The tool will add a number at the beginning of each line automatically. No setup, no options to configure.
Does the numbering start at 1?
Yes, the first line is numbered 1 and each subsequent line counts up from there.
Can I add line numbers in Notepad or a plain text editor?
Notepad does not have a built-in way to add line numbers to the actual text content. It can show line numbers in the status bar for your own reference, but those do not get saved with the file. If you need line numbers as part of the text itself, pasting into this tool and copying the result back is faster than any manual approach.
How do I add line numbers in Word?
Microsoft Word has a built-in line numbering feature under the Layout tab, but it applies numbers as a visual margin element, not as part of the actual text. If you need the numbers to be literally in the text content, this tool is the more direct route. Paste here, copy the result, paste it back wherever you need it.
How do I add line numbers in VS Code?
VS Code shows line numbers in the editor gutter by default, but again, those are just a display feature. If you need numbered lines as actual text to share or export, this tool handles that. For VS Code specifically, there are also extensions that can do it, but for a quick paste-and-go situation this is simpler.
Will blank lines get a number too?
That depends on how the tool handles empty lines. Generally, blank lines in the input count as lines and receive a number. Worth checking the output if your text has a lot of spacing.
What separator is used between the number and the text?
Typically a period or a space after the number, so lines come out looking like "1. This is line one" or "1 This is line one." The exact format is visible in the output once you process your text.
Can I use this for code files?
Yes, though keep in mind that adding numbers to the text of a code file will make the code itself non-functional since the numbers become part of the content. This is best for sharing or displaying code as text, not for editing and running it afterward.
Is there a limit on how many lines I can number?
No hard limit is set. For typical use cases like a script, a list, or a code snippet, it handles things without any issue.