← All tools
// Text

Add Line Numbers online

Add line numbers to any block of text — customisable format

Add Line Numbers logo
by
CHUNKY
MUNSTER
// Input text

How to Use the Add Line Numbers

  1. Paste your text into the input panel.
  2. Set the start number, delimiter and padding to taste.
  3. Tick 'Skip empty lines' if you want blanks left unnumbered.
  4. The output panel updates live; click Download .txt to save.

Add Line Numbers prefixes every line of an input block with a sequential counter. You control the starting number, the delimiter that separates the number from the text (default '. '), and whether numbers are space-padded so the columns line up. The whole pipeline runs on every keystroke so you can preview and tweak.

How the Add Line Numbers Works

Padding width is computed from the largest number that will be emitted, so a 1000-line block starting at 1 reserves four columns for the gutter and you get ' 1.', ' 2.', ..., '1000.'. With 'Skip empty lines' enabled, blank lines pass through untouched and do not consume a number — useful when numbering paragraphs of prose rather than every line of a code block.

Frequently Asked Questions

Does the line numbering preserve the original line breaks?

Yes. The text is split on \n, prefixed, and re-joined with \n. Trailing newlines are preserved. Windows-style \r\n input becomes \r\n on output because the \r stays at the end of each line.

How does padding work?

When 'Pad numbers' is on, every number is left-padded with spaces to match the width of (start + line count). So a 10-line block starting at 1 produces ' 1.', ' 2.', ..., '10.' — the columns line up regardless of digit count.

Can I start counting from a number other than 1?

Yes — change the Start field to any non-negative integer (0, 100, 9999). The padding width is then computed from the largest number actually emitted, so columns still align.

What happens to empty lines when 'skip empty' is on?

Empty or whitespace-only lines pass through with no number prefix and don't consume a number — the next non-empty line gets the next sequential number, so the count reflects real content lines only.

Explore the full suite of Text tools and 290+ other free utilities at Chunky Munster.