Glyph WidgetsGlyph Widgets
AboutContactPrivacyTermsSupport on Ko-fi

© 2026 Glyph Widgets. All rights reserved.

·

100% Client-Side Processing

Add Line Numbers

Last updated: March 5, 2026

Add line numbers to each line of your text with customizable starting number, separator style, and optional zero-padding for alignment.

Separator:
0 lines
0 lines
Share

Saved Presets is a Supporter feature.

Tool History is a Supporter feature.

Tool Notes is a Supporter feature.

Features

  • ▶Customizable starting number
  • ▶Multiple separator styles
  • ▶Optional zero-padding
  • ▶Real-time preview
  • ▶Copy to clipboard
  • ▶Works offline

How to Use This Tool

1

Enter Text

Paste your text that needs line numbers.

2

Customize Format

Choose your preferred number format and separator.

3

Copy Numbered Text

Copy the numbered lines to your clipboard.

Line Splitting and Enumeration

The tool splits text by line break characters (\n, \r\n, \r) creating an array of lines. Each line is then prepended with a sequential number starting from your configured start value. The enumeration uses a simple counter that increments by 1 for each line, maintaining order even for blank lines.

Zero-Padding Algorithm

When zero-padding is enabled, the tool calculates the maximum number length (e.g., for 100 lines, max length is 3 digits). Each number is then padded with leading zeros using String.padStart() to match this length. For example, with 100 lines: 1 becomes 001, 10 becomes 010, 100 remains 100. This ensures perfect vertical alignment in monospace fonts.

Separator Formatting

After the (optionally padded) number, the tool adds your chosen separator before the line content. Separators can be period + space (1. ), colon + space (1: ), parenthesis + space (1) ), a tab character for importing into spreadsheets, or any custom text you specify. The original line content remains completely unmodified.

Performance and Privacy

All line numbering happens instantly in your browser using array mapping and string concatenation. The tool handles large files (up to 100,000 lines) efficiently. No server communication occurs - completely client-side for instant results and complete privacy.

Frequently Asked Questions

You can customize the starting number (default is 1), choose from various separator styles (period, colon, parenthesis, tab, or custom), and enable zero-padding for aligned numbers.

Related Tools

Remove Line Breaks

Remove or replace line breaks

Word Counter

Count words and characters

Text Sorter

Sort lines alphabetically