What does a line numbering tool do?
A line numbering tool puts a number in front of every line of text. The number is a label and, more usefully, an address: once lines carry positions, they can be referred to by number in a review, a bug report or a quotation, and a reader can be sent to an exact line instead of being told to look for a phrase.
The settings decide whether the result is merely decorated or genuinely aligned. Where the count starts matters when the input has a header that should not be numbered, or when the numbering has to match something else. The step matters for listings, where a step of ten gives the spacing programmers expect. Padding the number to a fixed width matters as soon as the count passes nine, because an unpadded number is one character wider per digit and shifts every line after it, which is what makes a supposedly neat block look crooked.
Blank lines are the other decision. Leaving them unnumbered is usually right: a blank line in a poem, a code sample or a pasted passage is a gap rather than an item, and numbering it wastes a number and breaks the correspondence between the count and the content. Turning the option off numbers everything, which is sometimes what an exact line count in the output requires.
How to add line numbers to text
- Paste the text into the left box. The line count and the number of lines to be numbered appear underneath.
- Choose the number format — 1. text, 1) text, 1: text, or a format of your own.
- Set the value the count starts from, and the step if the numbers should increase by more than one.
- Pick a fixed width for the number so the text after it lines up in a monospaced block.
- Leave the blank-line option on unless every line, including the gaps, must be counted.
- Copy the numbered result, or clear and start again with different settings.
Add Line Numbers to Text limits and rules
| Item | Limit |
|---|---|
| Number position | Before the line, or at the end of it |
| Formats | 1. text, 1) text, 1: text, 1 - text, a tab, a space, or any custom separator |
| Starting value | Any integer, including zero and negative numbers |
| Step | Any integer; a step of ten gives 10, 20, 30 |
| Padding | None, or pad to 2, 3 or 4 digits with leading zeros |
| Blank lines | Left unnumbered and uncounted by default, or numbered with the rest |
| Not covered | Numbering lines inside a PDF or an image, which needs an extractor first |
When to use it
- Numbering the lines of a poem, a song lyric or a quotation for reference.
- Adding row numbers to a list of requirements before a review.
- Producing a BASIC-style listing with the customary step of ten.
- Numbering a code or configuration sample so a bug report can point at a line.
- Adding padded numbers to items so a monospaced block stays aligned.
Is it private?
The numbering is done in this page, one line at a time, and nothing is sent anywhere. Your text is never uploaded, stored or logged.
Frequently asked questions
Set the starting value to 2, or delete the header line before numbering and paste it back afterwards. Starting at 2 is the cleaner route when the output has to keep the header as a line but not count it, and it also makes the numbers line up with a scheme where the first item is already numbered elsewhere. A start value of zero is right when the numbering should match an index that begins at zero.
So that the text after them lines up. A number with one digit is one character wide and a number with two digits is two, so unless the numbers are padded every line after the ninth shifts right by one character and the block loses its left edge. Padding to a fixed width with leading zeros keeps the column straight, which matters for code, tables and anything that will be read in a monospaced font.
By default they are left out, and the number sequence skips over them, which keeps the numbers aligned with the content rather than with the gaps. A poem, a code sample or a pasted passage usually has blanks that are not items, and numbering them wastes a number and shifts every real line. Turn the option off when an exact count of physical lines is required, such as when the output must match a fixed line total.
Yes. One of the number formats places the number at the end of the line, separated by the chosen punctuation, which is occasionally wanted for a table of contents or a sidebar listing. Everything else — the starting value, the step, the padding — behaves the same way, so the sequence is identical and only its position in the line changes.
It sets how much the count increases per line. A step of one gives ordinary consecutive numbering, and a step of ten gives the spacing used by classic BASIC listings and some legal and technical documents, where a new line could be inserted between two existing numbers without renumbering everything. Negative steps count downwards, which is a rarer but legitimate use.
No — it numbers text, not documents. A PDF is a description of a page rather than a list of lines, so there is no reliable line to number until its text has been extracted, and extraction often changes the line breaks. The workflow that works is to extract the text first, for instance with the PDF to Image or the image-to-text tools, then run the result through this tool once it exists as plain lines.
Related tools
Written and maintained by Md. Nur Hossain Repon.