To add line numbers to text, paste the original lines, pick a starting integer between 0 and 999999, choose a separator such as ". " or "|", and download the previewed result as a UTF-8 plain-text TXT file. The output keeps every line of the original input — including blank ones — and prefixes each one with a sequential integer that begins at the chosen starting value and increments by one for every logical line. The transformation runs in the browser, so the text never leaves the device, and the preview shown on the page is exactly the bytes that land in the downloaded file. That makes the result predictable: same input, same options, same numbered output. The tool is built for situations where readers need a stable reference index for each line of text — code-review comments, transcript citations, legal-review working copies, classroom handouts, log excerpts, or any workflow where numbered lines can be quoted and re-quoted without ambiguity.

A Worked Example of Numbering Lines
Start with three lines of plain text — the word "alpha", a blank line, and the word "beta" — and use the default starting number of 1 with a period-and-space separator. The tool sees three logical lines because it counts the blank line in the middle.
| Input | Output |
|---|---|
| alpha | 1. alpha |
| (blank line) | 2. |
| beta | 3. beta |
This rule preserves the positional relationship between numbers and the original line sequence. If a new line is inserted in the middle later, every number below it shifts in lockstep, because every line receives the next number, including blanks. To see the same input with a different separator, change the separator to a vertical bar without touching the text, and the same three lines become "1|alpha", "2|", and "3|beta". The original line text is unchanged in every case; only the prefix changes.
Starting Number, Separator, and Zero Padding
Three controls shape how the numbered list looks. The starting number must be a whole non-negative integer with at most six digits, so values from 0 up to 999999 are accepted. The separator is the literal characters placed between the generated number and the original line content; up to 20 Unicode characters can be used, including a period, a colon, a vertical bar, a tab, or simply a space. Separator characters are not escaped or interpreted as regular expressions, so a literal dot is just a dot. Common choices include ". ", ":", "|", and a tab character pasted from the clipboard.
Zero padding uses the digit width of the final generated number in the result. Starting at 8 with three lines produces "08", "09", and "10" because the last number reaches two digits. Starting at 1 with nine lines keeps ordinary one-digit numbers because the largest value still has one digit. Turning padding off renders each number at its natural width, which is useful for prose or poetry where alignment is not critical. Padding affects only the generated numeric prefix, never the original line text, so blank lines remain blank after the number and separator.
Real-World Examples by Use Case
The same workflow serves several kinds of work. The table below summarizes common scenarios, the kind of separator that tends to fit each one, and the role the line numbers play in the final document.
| Use Case | Typical Separator | Why Numbering Helps |
|---|---|---|
| Code review comments | Tab or vertical bar | Reviewers cite "line 42" instead of quoting the line |
| Transcript or interview excerpt | Period and space | Speakers or timestamps can be referenced by line |
| Poetry or script drafts | Period and space | Line references survive editing and quoting |
| Support logs and chat exports | Colon | Each log line keeps a stable identifier for escalation |
| Legal-review working copies | Vertical bar or colon | Counsel refers to a paragraph and line without ambiguity |
| Classroom handouts | Period and space or closing parenthesis | Students and teachers match questions to specific lines |
Pick the format that matches the document the lines will eventually live in. A legal-review copy that will be pasted into a formatted memo often reads cleanly with a colon, while a code-review comment that ends up in a pull request looks better with a tab or vertical bar. The exact separator is up to you, and changing it never alters the line content underneath.
Adding Line Numbers: The Workflow
- Open the Add Line Numbers to Text page and paste or type the text you want to number into the input area. Plain text from any source works; the tool recognizes Windows CRLF, classic Mac CR, and Unix LF line endings as line boundaries.
- Choose the starting number, the separator characters, and whether to pad numbers with leading zeros. The starting number is a whole non-negative integer from 0 to 999999, the separator is up to 20 Unicode characters treated literally, and padding is a single on-or-off toggle.
- Select "Add line numbers" to generate the result. The preview area shows the exact transformed text, with preformatted wrapping so spaces and line breaks remain inspectable while long lines can wrap visually without adding extra newline characters to the download.
- Download the result as a UTF-8 plain-text TXT file. The file uses a single LF character between output lines, contains no byte-order mark, and matches the preview byte-for-byte. Editing any option clears the old result and revokes its download URL, so the file you save always matches the most recent settings.
How Blank Lines, Whitespace, and Line Endings Are Handled
Every logical line receives a number, including empty lines and lines that contain only spaces or tabs. The tool does not trim line content, collapse repeated spaces, or reinterpret tabs, so the original line text survives the transformation character-for-character. CRLF, CR, and LF boundaries are all recognized as line separators and split consistently, and the preview and downloaded result use a single LF character between output lines. Numbers are rendered in ordinary base-ten digits without locale separators, so a German-locale "1.000" never appears by accident in the preview or the file.
A trailing newline at the end of the input creates a final empty logical line, and that line is numbered, so the output continues to represent the original line structure. That behavior is deliberate: counting only non-empty lines would silently renumber the document and break any references already made to specific line numbers.
When Numbered Lines Are the Right Tool
Numbering is the right choice when the goal is stable line identifiers that other people can cite. It is less appropriate when the task is actually a count rather than a transformation; for that, the Line Counter reports total, non-blank, blank, and longest-line counts without modifying the text. If the goal is to wrap every line with arbitrary characters rather than a sequential number, the Add Prefix and Suffix to Lines tool accepts a literal prefix and suffix and can be configured to skip blank lines.
Numbering also does not interpret an existing numbered list to renumber it intelligently, count only non-empty lines, or preserve the original mixed newline bytes from the source. The output is always normalized: one LF per line, no whitespace changes inside retained lines, and a consistent separator between the generated number and the original line content.
Input Size, Errors, and Edge Cases
The tool accepts up to 1,000,000 characters of input, which keeps browser work responsive and memory use predictable. Empty input, an invalid starting number, or a separator longer than 20 characters produces a visible error instead of a result. The starting-number validation limit applies to user input only, so a long input with many lines can still produce sequence values that grow past six digits without silent truncation; the tool does not wrap or truncate the numbers themselves.
The generated file is plain UTF-8 text with no byte-order mark. Rich formatting, syntax highlighting, spreadsheet columns, and document-file structures are outside the scope, so paste from a word processor should be plain text for predictable results. The transformation runs entirely in the browser using local string processing, splitting line boundaries with String.split and exposing the result as a local Blob for the TXT download. Because everything happens locally, the text is never sent to a remote server, and closing the tab ends the workflow.
If you're weighing options, Add a Prefix to Each Line on iPhone in Safari covers this in detail.
If you're weighing options, How to Add Quotes to Each Line in Notepad++ Correctly covers this in detail.