Skip to content
Toolcroft

Text Tools

Line Number Adder - Add Line Numbers to Text

Add line numbers to any block of text. Choose the starting number, separator, padding, and whether to skip blank lines.

Add line numbers to any text

Paste any block of text and this tool will prefix each line with a sequential number. You can configure the starting number, separator style (period, colon, pipe, etc.), whether numbers are padded for alignment, and whether blank lines are numbered.

Common use cases

  • Preparing code snippets for documentation where line numbers aid reference.
  • Numbering items in a list for ordered presentation.
  • Referencing specific lines when sharing text in reviews or discussions.

Removing line numbers

Use the Remove line numbers button to strip previously-added line numbers from the input, using the currently selected separator as the delimiter.

Delimiter variants

Different contexts expect different separator styles between the line number and the line content:

StyleExampleTypical use
Period1. line contentMarkdown ordered lists, prose documents
Colon1: line contentLog files, diffs, many code editors
Pipe1 | line contentTerminal output, stack traces
Tab-separated1 line contentSpreadsheet import, TSV processing

Custom starting number

Some use cases require continuing the numbering from a prior excerpt - for example, if you are splitting a large file and need the second excerpt to start at line 51. Set the starting number to match the actual line number in the source document so references remain accurate.

Programming note

When using line-numbered output for debugging, keep in mind that the line numbers added by this tool reflect the exported excerpt, not the original source file. Error messages from compilers, interpreters, and linters reference the original source file's line numbers. Renaming or renumbering lines in an excerpt can create confusion when cross-referencing error output - note this caveat when sharing numbered snippets for debugging purposes.