Add sequential line numbers to text

Attach sequential integer labels to physical lines with configurable origin, separator, width, and padding character.

freeworks offlinenothing uploaded
ToolLine Numberer
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

CRLF or LF creates the row array, then a counter advances only for rows selected for numbering. Starting at 1 with ": " is the default, and width zero aligns labels to the digits in start + physical row count − 1.

  • Blank rows receive labels unless empty-line skipping is enabled.
  • Output reconstruction always joins rows with LF.

Worked example

Number Lines
Add sequential line numbers to a code snippet
Input
											function greet() {
  return "hello";
}
										
Output
												1: function greet() {
2:   return "hello";
3: }
											

When to use this

Bug reports label log excerpts, code-review comments identify pasted snippet rows, and poetry worksheets number physical lines.

Edge cases

  • When empty rows are skipped, they keep no label and do not consume the next sequence number.
  • A negative starting value includes its minus sign when automatic padding width is calculated.
  • CRLF source text leaves with LF line endings even though every visible row receives the intended label.