Add Line Numbers to Text

Paste your text, choose a start number and format, and copy it back with every line numbered.

Your text and numbering options

Quick formats

How to add line numbers to text

  1. Paste or type your text into Text to number, one item per line. Clear text empties the box.
  2. Click a Quick format such as 1. or [1], or set Before number, Start at, Separator (after number) and Minimum digits yourself.
  3. Tick Skip blank lines if empty lines should stay empty.
  4. Press Copy numbered text and paste the result where you need it.

How the numbering works

A line is whatever sits between two line breaks. Each output line is built as Before number, then the number, then Separator, then your original line. The first numbered line gets the Start at value and every numbered line after it adds 1.

Worked example

With the sample text and the defaults (Start at 1, Separator ". ", Minimum digits 0, nothing before the number), the tool shows:

1. First line
2. Second line
3. Third line

Choose the 1) quick format and set Minimum digits to 3 and the same text becomes 001) First line, 002) Second line and 003) Third line.

Limits and edge cases

Start at takes a whole number of up to 18 digits and Minimum digits takes 0 to 12. A decimal such as 1.5 or an empty field shows a message under the text and numbering starts at 1. The text is processed in your browser and is not uploaded. To order the lines first use the Line Sorter, to strip blank lines or extra spaces use the Whitespace Cleaner, and to drop repeated lines use the Duplicate Line Remover before you number.

Frequently asked questions

How do I get 001, 002, 003 style numbers?

Set Minimum digits to 3. The tool adds leading zeros up to that width, so 1 becomes 001 and 12 becomes 012. Numbers that are already longer, such as 1000, are never cut.

Can I use 1) or [1] instead of 1.?

Yes. Click the matching quick format, or type your own in Before number and Separator. For [1], put [ in Before number and ] followed by a space in Separator.

How do I start at 0 or at 100?

Type 0 or 100 in Start at. Any whole number works, including negative numbers such as -5.

Does it number blank lines?

By default every line gets a number, blank ones included. Tick Skip blank lines to leave empty lines as they are without using up a number.

How do I add line numbers to code so it lines up?

Set Minimum digits to the width of your last line number, for example 2 for up to 99 lines, so every number is the same width. Then use a separator such as a colon and a space, or the Tab quick format.