Line Number Generator

Prefix each line with a sequential number. Configure the starting number, separator, and optional zero-padding.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about text

How to Add Line Numbers to Text

Line Numbering

When to Number Lines

Add line numbers when sharing code snippets, referencing errors in logs, preparing documentation examples, or comparing text side by side with stable references.

Real-World Examples

1 | const x = 1; — pipe separator for code reviews

Start at line 100 when continuing a numbered excerpt

Zero-pad numbers (001) for aligned log references

Common Mistakes

  • Numbering before removing blank lines when you want consecutive content lines only
  • Using wide separators that break copy-paste into compilers
  • Forgetting to set start offset when excerpting from a larger file

Developer Tips

  • Configure start number, separator, and zero-padding in Tool Settings
  • CLI: nl -ba file.txt for similar output
  • Pair with Remove Blank Lines for compact numbered output

Frequently asked questions

Can I customize the separator?

Yes. Tool Settings let you choose the separator between the line number and content (pipe, tab, colon, etc.).

Do blank lines get numbers?

Yes. Every line including empty lines receives a sequential number.

Can I start numbering from zero?

Yes. Set the starting number in Tool Settings to any value you need.