Glyph WidgetsGlyph Widgets
О проектеКонтактыБлогКонфиденциальностьУсловияПоддержать на Ko-fi

© 2026 Glyph Widgets. Все права защищены.

·

100% обработка на стороне клиента

Вернуться в блог

Add Line Numbers: Number Every Text Line

Add line numbers to text instantly. Customize start number, separator style, and zero-padding alignment. Free browser-based.

Glyph Widgets
27 февраля 2026 г.
9 min read
add line numbersnumber lines onlineline numberingnumber text linesadd numbers to lines

What Is Add Line Numbers?

Add Line Numbers is a free online tool that prefixes every line in a block of text with a sequential number. It solves the practical problem of needing numbered output without a code editor or word processor: pasting code into a document, preparing numbered steps for instructions, creating indexed data for review, or identifying specific lines when collaborating with someone on a text file.

The tool offers a configurable starting number, five separator styles (including a custom option), and optional zero-padding so that numbers align when your content has more than nine lines. All processing happens in your browser — no files are uploaded, no data leaves your device. The tool is free with no account required.

Key Features

  • Customizable starting number — Begin numbering at any positive integer. Start at 1 for standard numbering, at 100 for page-relative numbering, or at any other positive value.
  • Multiple separator styles — Choose from dot-space (1. ), colon-space (1: ), parenthesis-space (1) ), tab (1\t), or define your own separator string.
  • Optional zero-padding — When enabled, line numbers are left-padded with zeros so they all have the same width. A 12-line block becomes 01., 02., ..., 12. instead of 1., 2., ..., 12.. The pad width is computed automatically from the last line number.
  • Real-time preview — The numbered output updates as you type; no button press required.
  • Line count display — Both panels display the number of lines being processed.
  • Copy to clipboard — One-click copy of the numbered output.
  • Batch mode — Process multiple blocks in one operation (supporter feature).

The underlying implementation splits the input on \n, maps each line to ${lineNum}${separator}${line}, and rejoins with newlines. Zero-padding uses JavaScript's String.padStart() with the width computed as the digit count of the final line number.

How to Use Add Line Numbers

Step 1: Set Your Starting Number

The "Start At" number input at the top left defaults to 1. Change it to any positive integer. If you clear the field, enter a non-numeric value, or enter zero, the tool falls back to 1.

Common starting values:

  • 1 — standard one-based line numbering
  • Any positive integer to continue a previously numbered block (e.g., 26 to continue from a previous 25-line block)

Step 2: Choose a Separator

Five separator buttons appear in the options bar:

ButtonSeparatorExample
. (dot-space). 1. First line
: (colon-space): 1: First line
) (paren-space)) 1) First line
Tab\t1\tFirst line
Customuser-defined1 >> First line

Selecting Custom reveals a short text input. Type any string — it will be placed between the number and the line content on every line.

Step 3: Enable Zero-Padding (Optional)

Check the Zero Padding checkbox if you want numbers to be left-padded so they align vertically. This is most useful for blocks exceeding 9 lines. For a 50-line block starting at 1, numbers become 01 through 50. For a 100-line block, 001 through 100.

Step 4: Paste Your Text

Click the Input textarea and paste or type your text. The Output panel on the right updates immediately.

Example input (5 lines, starting at 1, dot-space separator, no padding):

Introduction
Background
Methodology
Results
Conclusion

Output:

1. Introduction
2. Background
3. Methodology
4. Results
5. Conclusion

Same input with zero-padding enabled:

1. Introduction
2. Background
3. Methodology
4. Results
5. Conclusion

(No visible difference at 5 lines, but at 10+ lines: 01. through 10.)

Step 5: Copy the Result

Click Copy Result. A toast confirmation appears. The history panel (for supporters) also records the operation automatically on copy.

Practical Examples

Preparing Code for Review

You have a JavaScript snippet you want to paste into a GitHub issue or a document where line references matter. Paste the code with the default settings (start at 1, dot-space separator) and the output is a numbered listing your reviewer can reference precisely: "line 7 should use const instead of let."

Creating an Ordered Step List

You are writing a process document and have a bulleted list that needs numbering. Paste the list with the parenthesis-space separator. First task becomes 1) First task. Copy the result and paste it into your document without reformatting each line by hand.

Indexing a Data Export for Debugging

You exported 300 rows from a database and need to identify which row caused a parsing error. Add line numbers with zero-padding starting at 1. The resulting 001 through 300 format lets you jump to any row by its line number and makes log messages like "error on line 047" immediately actionable.

Tips and Best Practices

Use zero-padding any time you expect more than 9 lines. Without padding, 10 is three characters and 1 is one, so columns of numbers and content do not align in monospace output. Enabling padding ensures clean vertical alignment without manual adjustment.

The starting number affects padding width. The tool computes the last line number as startAt + lineCount - 1. If you start at 90 and have 20 lines, the last number is 109 (three digits), so zero-padding produces 090, 091, ..., 109.

Tab separator works best in monospace contexts. Tab-separated numbers align perfectly in code editors, terminal output, and CSV viewers but may render inconsistently in rich-text applications. Use dot-space or colon-space for documents.

Custom separator can include spaces. If you want - (space-hyphen-space), type those three characters in the custom input. The tool places the separator string verbatim between the number and the content.

Batch mode numbers each block independently. In batch mode, each item is a separate block. Each block receives its own numbering starting from the configured start number. The blocks do not share a continuous sequence.

Common Issues and Troubleshooting

Numbers are not aligning even with zero-padding enabled. Alignment only works in monospace fonts. Rich-text editors, word processors, and proportionally spaced fonts will not display the columns as aligned. Paste into a monospace context (code editor, terminal, <pre> block) to see the alignment.

The start number is being ignored. If the start number field is empty, contains a non-integer, or is set to zero, the tool silently falls back to 1. Enter a valid positive integer to override.

Blank lines in the input are receiving numbers. This is correct behavior — every line, including empty lines, receives a number. This preserves the line structure of the original. If you want to skip blank lines, remove them first using a different tool.

Output has unexpected extra line at the end. If your input ends with a newline character (a trailing blank line), that blank line is counted and numbered. This is common when pasting from certain sources. Delete the trailing newline in the input to remove the extra numbered line.

Copy button is disabled. The button is disabled when the output is empty. Paste text into the input first.

Privacy and Security

Add Line Numbers processes your text entirely in your browser using JavaScript's Array.map() and String.padStart(). No text is transmitted to any server. No network request is made during processing. The tool has no analytics attached to the computation. Once the page loads, it works without an internet connection.

Frequently Asked Questions

Is Add Line Numbers free? Yes, entirely free. The core functionality — paste text, choose settings, copy numbered output — requires no payment and no account. Supporter features (presets, history, batch mode) require a Glyph Widgets supporter subscription.

Does it work offline? Yes. After the page loads, all processing is local. You can disconnect from the internet and the tool continues to work.

Is my text safe? Your text never leaves your browser. The tool does not send content to any server. If you use the history feature, a copy of inputs and outputs is stored in your browser's local IndexedDB storage — entirely on your own device.

Can I start numbering at 0? No. The tool requires a positive starting number. If you enter 0, it falls back to 1. The minimum effective starting value is 1.

Can I continue numbering from a previous block? Yes. If your first block had 25 lines and you want the next block to start at 26, set Start At to 26. Zero-padding will account for the new starting value when computing pad width.

What separators are available? Five options are built in: dot-space (. ), colon-space (: ), parenthesis-space () ), tab (\t), and a custom field where you can type any string. The custom field accepts any characters including spaces, symbols, and multi-character sequences.

Does zero-padding update dynamically as I type? Yes. The padding width is computed as the digit count of the last line number (startAt + lineCount - 1), and the output re-renders on every keystroke. Adding more lines increases the padding width automatically if the digit count grows.

Can I number lines in a multi-column CSV? The tool adds numbers as a prefix to each line, not as a new column. For a CSV, the output would be 1. col1,col2,col3 rather than 1,col1,col2,col3. If you need the number as a proper CSV column, use the Tab separator and then replace the tab with a comma in a subsequent step.

What happens with Windows line endings in my input? The tool splits input on \n. Windows files use \r\n. Most browsers normalize pasted text to \n, but if \r characters appear in your output, paste the content through a text editor first to normalize line endings.

Can I process many files at once? Batch mode (supporter feature) lets you enter multiple independent text blocks (one per batch line) and process them all with a single click. Each block receives independent line numbering starting from the configured start number.

Related Tools

  • Remove Line Breaks — Strip line breaks before or after adding numbers, useful when combining steps in a workflow.
  • Word Counter — Count lines, words, and characters in your text.
  • Sorter — Sort lines alphabetically or numerically before numbering them.

Try Add Line Numbers now: Add Line Numbers

Последнее обновление: 27 февраля 2026 г.

Продолжить чтение

Ещё статьиПопробовать Add Line Numbers