Add Line Numbers to Text

Number every line of your text, choose where to start and what follows the number, or strip numbers off a list. Good for code, lyrics, contracts and lists.

Numbering lines sounds trivial until you have to do it for 200 lines of a contract clause, a poem, a code sample for a bug report, or a script that a group is going to read aloud. Doing it by hand takes ten minutes and invites mistakes. This tool numbers everything instantly, and can take the numbers off again.

Paste your text and choose whether to add or remove numbers. The result is ready to copy straight away.

Adding numbers

Set the number to start from, which is 1 by default but can be any whole number: 0 for programmer-style lists, 101 to continue from a previous section. The text after the number is yours to choose. A full stop and space gives “1. First line”. A bracket gives “1) First line”. A colon and space looks like a log. A tab, written as \t, makes a column that pastes neatly into a spreadsheet.

Zero padding keeps long lists aligned. With 120 lines, numbers become 001, 002, and so on, and the text lines up down the page. The padding width is worked out from the highest number needed.

Empty lines are not numbered by default, and they do not use up a number. A paragraph of text with blank lines between stanzas gets 1, 2, 3 through the writing, rather than numbering the gaps. Untick that option if you want every physical line numbered, which is how code line numbers work.

Taking numbers off

“Remove line numbers” deletes a number at the start of each line, along with a trailing full stop, bracket, colon or dash after it and one space. It is built for lists numbered like “1.”, “3)”, “12:” or “(4)”.

It cannot tell a list number from a real number that begins a line. A line that starts “2026 budget” loses the “2026”, and “3rd place” is left as “rd place”. Look over the result, or run it on only the lines that are numbered.

When this is the wrong tool

If you want to add something that is not a number, such as quote marks or a bullet to the start of every line, add text to each line does that, and also joins lines with a separator. To put a numbered list in order, run sort lines first, since sorting after numbering mixes the numbers up. Clearing out gaps before you number is a job for remove empty lines, and keeping code indentation consistent is the tabs to spaces converter.

Frequently asked questions

Can I number from a different starting number?

Yes. Set "Start at" to any whole number, including 0 or a negative one. Continuing a list from a previous section is the usual reason.

Why did removing numbers delete part of my text?

The tool strips any digits at the start of a line, whether they are a list number or not. A line beginning "3rd place" loses the "3". Run the removal only on lines that were really numbered.

How do I put a tab after the number so it pastes into Excel?

Enter \t in the "After the number" box. Each line then has the number, a tab, and the text, which a spreadsheet splits into two columns.