UtilityKit

500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.

Line Numberer

Add line numbers to text with custom start, padding, separator, and empty-line handling.

About Line Numberer

Adding line numbers to text is a small task that comes up more often than you would expect: sharing a code snippet where you need to reference specific lines in a discussion, preparing a document for review where annotators will cite line numbers, creating a numbered script or screenplay, or generating a quiz answer key with numbered items. Line Numberer adds line numbers to any block of text with full control over the starting number, separator character (colon, tab, period, or space), number padding width, and how empty lines are treated. Numbers can start at any value, allowing continuation from a previously numbered section. Padding with leading zeros ensures alignment in monospace contexts.

Why use Line Numberer

Custom Starting Number

Start at any line number to continue numbering from a previous section or match an existing document's line references.

Configurable Separator

Choose colon, tab, period, or space to match the formatting convention of your document or code style.

Zero-Padding for Alignment

Pad numbers with leading zeros so columns align correctly in monospace code editors and terminals.

Empty Line Control

Decide whether blank lines get a number or are skipped — important for prose documents where blanks are paragraph breaks.

Instant Preview

Output updates in real time as you adjust settings — no need to re-paste your text for each configuration change.

Works for Code, Scripts & Documents

Useful equally for code snippets shared in forums, numbered draft documents, quiz answer keys, and stage scripts.

How to use Line Numberer

  1. Paste your text into the input area.
  2. Set the starting line number (default is 1).
  3. Choose your separator: colon, tab, period, or space.
  4. Set padding width — '0' for no padding, '3' for zero-padded three-digit numbers.
  5. Choose whether empty lines receive a number or are skipped.
  6. The numbered output appears instantly; click Copy to copy it.

When to use Line Numberer

  • When sharing a code snippet in a forum or pull request comment where lines need to be referable by number.
  • When preparing a document for peer review or legal annotation where reviewers cite specific lines.
  • When creating a numbered list of instructions or steps where sequential numbering is required.
  • When generating a line-numbered transcript or script for production notes.
  • When debugging output that needs line context to cross-reference with a source file.
  • When formatting a numbered quiz, test, or answer sheet where each item must have a sequential number.

Examples

Basic code snippet

Input: function hello() { return 'world'; }

Output: 1: function hello() { 2: return 'world'; 3: }

Zero-padded 3-digit numbers

Input: Line one Line two Line three

Output: 001: Line one 002: Line two 003: Line three

Tab-separated starting at 10

Input: Apple Banana Cherry

Output: 10 Apple 11 Banana 12 Cherry

Tips

  • Use tab as the separator when you plan to paste the numbered output into a spreadsheet — each number will land in column A and the line content in column B.
  • Set padding width to match the expected total line count: 3 digits for documents under 1,000 lines, 4 for larger ones.
  • Skip empty lines for prose documents so paragraph breaks do not consume sequence numbers.
  • Number empty lines for code snippets so the output matches what developers see in their editor's gutter.
  • Start at a number other than 1 when the snippet is extracted from the middle of a larger file and you want references to match the original file's line numbers.

Frequently Asked Questions

Can I start line numbering from a number other than 1?
Yes. Set the starting number to any positive integer. This is useful when appending to an existing numbered section and you want numbering to continue seamlessly.
What separator options are available?
You can choose a colon (:), a tab character, a period (.), or a space as the separator between the line number and the line content. Tab separation is useful for importing into spreadsheets.
What does zero-padding do?
Zero-padding adds leading zeros to line numbers so they are all the same width. For example, with width 3, line 1 becomes '001', line 10 becomes '010', and line 100 stays '100'. This aligns numbers in monospace displays.
How are empty lines handled?
You can choose to number empty lines (giving them the next sequential number) or skip them (leaving blank lines as blank without a number). Skipping is preferred for prose; numbering is preferred for code.
Does it modify the content of non-empty lines?
No. The tool only prepends the line number and separator — the content of every non-empty line is preserved exactly as entered.
Can I remove line numbers that were already added?
The tool adds numbers; it does not have a remove mode. To strip existing line numbers, use the Find & Replace tool with a regex like ^\d+[:.\t ] to match and delete the numbering prefix.
Does it work with very long documents?
Yes. Line numbering is a fast O(n) operation and processes thousands of lines instantly in the browser.
What is the maximum starting line number?
There is no practical limit — you can start numbering at any integer, including large values like 1000 or 5000.

Explore the category

Glossary

Line number
A sequential number prepended to each line of text, used to allow precise reference to specific lines in a document or code listing.
Zero-padding
Adding leading zeros to numbers so all numbers have the same digit width, enabling proper column alignment in monospace fonts.
Separator
The character(s) placed between the line number and the line content, such as a colon, tab, or space.
Gutter
The narrow column to the left of code in an editor that displays line numbers, breakpoints, and other indicators.
Monospace font
A font where every character occupies the same horizontal width, making character-based alignment and column formatting reliable.
Continuation numbering
Starting a numbered section from a value greater than 1 to continue the line count from a previous section of a document.