ZapKit

Add Line Numbers to Text

Number each line of a list, script, poem or code snippet with your choice of start number and format, or remove numbers that are already there.

What is a line numbering tool?

A line numbering tool puts a number in front of each line of text. Numbered lines make it easy to refer to a specific place: teachers number lines of a poem for discussion, lawyers and editors cite line numbers in contracts and manuscripts, and developers share code with line references for review.

It also turns a plain list into a numbered list for a document or message, and works in reverse: paste a list that's already numbered and strip the numbers so you can re-sort it or paste it into a tool that adds its own numbering.

How to use the Add Line Numbers to Text

  1. 1.Paste the text

    Each line will get its own number.

  2. 2.Choose the format

    Start at any number, pick 1. or 1) or a tab after it, and pad with zeros if you like.

  3. 3.Copy the numbered text

    Or switch the action to Remove line numbers to strip them back off.

Example: four lines with a gap

Lines: First line, Second line, an empty line, Fourth line after a gap, with the default settings:

Line 1
1. First line
Line 2
2. Second line
Line 3
(empty, not numbered)
Line 4
3. Fourth line after a gap

Three lines are numbered and the empty one is skipped, so the numbering has no gaps.

Numbering that suits the job

Blank lines are skipped by default, so paragraphs separated by empty lines are numbered 1, 2, 3 without gaps. Untick that option to number every physical line, which is what you want for code reviews and legal line references.

Zero padding makes every number the same width, 01 to 99 or 001 to 250, which keeps columns aligned and sorts correctly in file names. Remove line numbers recognises the common forms 1. 1) 1: 1 | and tab-separated numbers at the start of a line.

Frequently asked questions

Can I start from a number other than 1?

Yes. Type any whole number in Start at, such as 0 or 101 to continue a previous list.

How do I remove line numbers from copied code?

Set Action to Remove line numbers. The number and the separator after it are taken off each line.

Can empty lines get a number?

Yes. Untick Don't number empty lines and every line, blank or not, is numbered.

What separators are available?

A full stop, a bracket, a colon, a vertical bar, a tab or a single space after the number.

More Utilities tools