Guide

How to Add Line Numbers to Text

Paste the text, choose the starting number and formatting options, and inspect the processed result. Blank-line numbering changes when skipping is enabled.

Tool Add Line Numbers

When to number plain text

Add line numbers to pasted text when readers need to refer to individual lines in a draft, transcript, list, or other plain-text material. The tool places sequential numbers before eligible lines while preserving the original line content after the selected separator. It also gives you control over the first number, the visual width of the numbers, and the treatment of blank lines.

The text field is optional, so you can open the tool before deciding what to process. If the supplied text is empty or otherwise falsey, processing succeeds with empty processed text rather than creating numbered output. For non-empty text, the result is based on the newline characters in the input, which makes the source text and its line-break format important when you are checking the result.

Prepare, configure, and inspect the text

  1. Enter or paste the text into the input area. The input can be left empty, although empty input returns empty processed text.
  2. Choose the starting number, or keep the default of 1. A supplied starting value is converted to an integer, while a falsey value uses 1; the resulting value cannot be below 0.
  3. Choose the separator placed between each formatted number and its original line content. If you do not change it, the separator is a period followed by a space.
  4. Decide whether to keep zero-padding enabled. With zero-padding enabled, numbers use the decimal width of the largest number assigned to the input. Turn it off to display numbers without leading zeroes.
  5. Decide whether empty or whitespace-only lines should be skipped. Skipping is off by default. When enabled, those lines stay unchanged and do not advance the numbering.
  6. Review the processed text and copy it for use wherever numbered lines are needed.

Check numbering, padding, and line boundaries

A successful non-empty result contains numbered lines joined with newline characters. Each numbered line begins with the formatted sequence value, followed by the selected separator and the original line content. The sequence reflects the starting value after its normalization, rather than necessarily reflecting the literal form in which that value was entered.

Padding is calculated from the decimal width of the maximum number assigned for the input when the option is active. Consequently, the visual width can depend on the chosen starting value and the number of eligible lines, so inspect later values as well as the first one. With padding turned off, the output uses unpadded decimal numbers.

Blank-line behavior is easiest to verify by looking at both the blank position and the next numbered line. When skipping is on, an empty or whitespace-only line stays in place and the following non-empty line receives the next number that follows the preceding eligible line. When skipping is off, the default setting allows those lines to receive numbers, so a result with numbered blank positions may be intentional.

The tool’s line model is limited to newline characters. Do not treat other Unicode separators, carriage returns by themselves, or boundaries inside a structured document as confirmed line breaks for this process.

Worked example

You are preparing a short two-line reference whose numbering needs to begin at 8.

Enter alpha and beta on separate lines, set the starting number to 8, turn off zero-padding, and retain the period-and-space separator.

The processed text contains two newline-separated lines: "8. alpha" followed by "9. beta".

Limitations

  • The process divides non-empty input only at newline characters and rejoins the resulting lines with newline characters; other separators and structured-document boundaries are not established as line breaks.

Common errors

  • If a blank position receives a number, the likely cause is that skipping remains disabled, which is the default; enable skipping for empty or whitespace-only lines and verify that the intended breaks are newline characters.

FAQ

What happens when I leave the text field empty?

An empty or otherwise falsey input returns successfully with empty processed text, so there is no numbered content to inspect.

How is the first line number determined?

The default is 1. If a starting value is supplied and treated as truthy, it is converted to an integer; a falsey value becomes 1, and the resulting number cannot be lower than 0.

How can I keep blank lines unnumbered?

Yes, provided you enable skipping. Empty or whitespace-only lines then stay unchanged and do not move the sequence forward, whereas the default setting leaves skipping disabled.

Tool

Add Line Numbers