About Add Line Numbers
Add Line Numbers puts a number in front of every line of a block of text. It is a small job, but it is the one people reach for when they need to refer to specific lines of a log excerpt, a code fragment or a list they are about to discuss with somebody else. The sample that loads with the page is three lines long and comes back numbered one, two and three.
The mechanics are deliberately plain. The text is divided at every newline character, and each line is rebuilt as its position in the list, a full stop and a single space, followed by the original line content. The count begins at one and advances by one. Because the division happens on the newline character itself, an empty line still receives its number, and a block that ends with a line break gains one final numbered empty line - usually the reason a numbering run comes back with a trailing stray.
Nothing is normalised on the way through. Lines are not trimmed, so trailing spaces survive, and a line that already carries a number gets a second one in front of it. The digits are not padded either, which means the text after them does not line up into a column. For a numbered listing meant to be read as a table a padded format would be needed; for a reference aid the ragged version is enough.
How to use Add Line Numbers
- 1 Paste the block of text into the panel, or keep the sample to see the shape of the output.
- 2 Read the result, where each line now begins with its position and a full stop.
- 3 Copy the numbered block out for a bug report, a review comment or a set of instructions.
- 4 Strip any existing numbering first, because the page will not detect numbers that are already there.
Frequently asked questions
Why does the numbered output have an extra empty line at the end?
Because the text is divided on the newline character, and a block that ends with one therefore produces a final empty line that still receives a number. Remove the last line break in the input if you do not want it.
Can the numbering start at a different value?
No. It always begins at one and always advances by one, and there is no field to change the starting value, the step or the separator that follows the number.
Are the numbers aligned into a column?
No. There is no zero padding, so a two digit number pushes its text one character further right than a single digit number does. The output is a numbered list, not a fixed-width listing.
What happens if I run the output through the page again?
It numbers the numbered lines and produces two numbers in front of each one. The page does not check whether text has already been numbered, so run it once against the original text.
Free, online, and private
Free to use
Add Line Numbers is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How Add Line Numbers behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Input | one text panel, recalculated live; the sample is three lines reading first, second and third |
| Dividing | the text is divided on the newline character, so the number of output lines always equals the number of lines typed |
| Prefix | each line receives its position counting from one, followed by a full stop and a single space |
| Blank lines | an empty line still receives its number, so a gap in the text appears as a number followed by nothing |
| Trailing break | text that ends with a line break produces one extra numbered empty line at the end |
| Output | the same lines, each one longer by its number and the two separator characters |
Compiled from the implementation of this tool and checked against it by itoolnet.
What Add Line Numbers does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- Every line is treated the same, including one that already carries a number. Running the output through the page a second time stacks another number in front of the first, and there is no detection of text that has already been numbered.
- The digits are left ragged. There is no zero-padding option and no alignment, so the text after the numbers does not form a column - line ten begins one character further right than line nine, and the result is not a fixed-width listing.
- The numbering is fixed in two ways: it always starts at one and it always advances by one. There is no way to begin at a different number, to number every other line, or to choose a different separator such as a colon, a bracket or a tab.
Tested and documented by itoolnet, the team that builds and maintains this site.