Text tools

Add Line Numbers

Add Line Numbers to Text

Number every line of text in any format (1. 1) [1] 001), with start, step and padding; or remove line numbers.

About this tool

About Add Line Numbers

Number the lines of a script, a contract clause list, a poem for a class discussion or a code sample in a bug report, so everyone can refer to "line 14" without counting. Pick a format (1. with a dot, 1) with a bracket, [1], 1:, 1 | or a number followed by a tab, which pastes neatly into spreadsheets), or write your own template where # stands for the number, such as Step #: or Q#. Start at any number, count in steps of 1, 5 or 10 (or downwards with a negative step), and pad numbers with zeros (001, 002) or spaces so the text lines up in a monospaced font. Skip empty lines when you only want to number real entries. Switch the action to Remove numbers to strip numbering from text copied out of an editor, a PDF or a terminal; common formats are recognised, and plain numbers followed by spaces are only removed when most lines start that way, so a sentence beginning with a year is left alone. It all happens in your browser.

Built and maintained by Abhi JainUpdated

How to Add Line Numbers

  1. 1

    Paste the text

    Paste text or code into the Text box, or click Sample.

  2. 2

    Choose the numbering

    Pick a Format (or Custom with a Template), then set Start at, Step, Padding and Skip empty lines.

  3. 3

    Copy the numbered text

    Copy or Download the Numbered text. To strip numbers instead, choose Remove numbers.

Add Line Numbers: questions and answers

How do I number only the lines that have text?

Tick Skip empty lines. Blank lines stay in place without a number and are not counted, so the numbering runs 1, 2, 3 across real lines.

Can I start numbering from a different number?

Yes. Set Start at to any number, such as 101 for the second page of a list, and Step to count in 2s, 10s or backwards with a negative step.

How do I make numbers line up?

Choose Padding: Zeros writes 001…120, Spaces right-aligns them. With a monospaced font the text after the numbers then starts in the same column on every line.

How do I remove line numbers from copied code?

Switch to Remove numbers. Prefixes such as 12., 12), [12], 12:, 12 | and 12 followed by a tab are removed from every line. Numbers followed only by spaces are removed when at least 80% of lines start that way.

Ready-made Add Line Numbers presets