Add Line Numbers

Add line numbers to text or code.

Text

About Add Line Numbers

Adding line numbers to text is a common task for developers, writers, and support engineers. When discussing code, referencing "line 42" is only useful if both parties can see the numbers. This browser-based tool instantly numbers every line in your input, with your choice of separator format and optional right-alignment for clean presentation. It handles any text length and preserves blank lines so the numbering stays accurate. Since all processing happens in JavaScript on your device, there is no file-size limit imposed by a server and no risk of data exposure.

How to Use Add Line Numbers

  1. Paste or type your text into the Input box.
  2. Select a Separator style: pipe (1 | ), dot (1. ), colon (1: ), or tab.
  3. Check Right-align numbers if you want single-digit numbers padded with spaces to align with multi-digit numbers.
  4. Click Add line numbers. The numbered text appears in the Result box.
  5. Copy the result and paste it into your document, email, or code review.

Key Features

  • Multiple separator styles — pipe, dot, colon, and tab — to match your preferred format
  • Optional right-alignment keeps numbers neatly aligned regardless of digit count
  • Handles any text length, including large log files and long source code
  • 100% client-side processing — your text never leaves your browser
  • Instant results with one click; no signup or installation required

When to Use This Tool

  • Sharing code snippets in pull requests, emails, or documentation where line references matter
  • Preparing formatted log excerpts for bug reports or support tickets
  • Creating numbered lists from plain text for presentations or meeting notes
  • Adding line numbers before pasting into a Find & Replace workflow

Technical Details

The tool splits your input on newline characters (\n), assigns an incrementing number starting at 1, and prepends the chosen separator to each line. When right-alignment is enabled, numbers are left-padded with spaces so that the separator column stays consistent (e.g., lines 1–9 get a leading space when there are 10+ lines). The result preserves all original whitespace within each line. Processing is done entirely in JavaScript, so even files with thousands of lines are numbered in milliseconds.

Conclusion

The Add Line Numbers tool is a fast, privacy-friendly way to number every line in a text block. With configurable separators and alignment, it fits seamlessly into coding, documentation, and support workflows — all without leaving your browser.

Frequently Asked Questions

What format are the line numbers?
By default each line is prefixed with the line number followed by a separator (e.g. "1 | " or "1."). You can choose the separator and whether to right-align numbers.
Is my text sent to a server?
No. All processing is done entirely in your browser. Your text never leaves your device.
Can I use this for code?
Yes. Adding line numbers to code snippets helps when discussing specific lines in documentation, support tickets, or code reviews.
What happens with very large files?
The tool processes text of any length in your browser. Even thousands of lines are numbered in milliseconds. For extremely large files, performance depends on your device memory.