Embed this tool on your site
About this tool
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 control over the starting number, the separator text placed after each number (up to 16 characters, '. ' by default), zero-padding, and whether empty lines are numbered. Auto padding, on by default, pads every number to the width of the largest one; turn it off to set a fixed Padding width from 1 to 12. Numbers can start at any value, allowing continuation from a previously numbered section. The output updates as you type and can be copied with one click.
Why use it
Custom Starting Number: Start at any line number to continue numbering from a previous section or match an existing document's line references.
Free-Form Separator: Type any separator up to 16 characters — period, colon, pipe or a pasted tab — to match 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
- Paste your text into the Input text box.
- Set the Start number (default is 1).
- Type the Separator to place after each number, such as '. ', ': ' or a pasted tab.
- Keep Auto padding on to pad numbers to the same width, or turn it off and set a Padding width from 1 to 12.
- Tick Skip empty lines if blank lines should stay unnumbered.
- The numbered output updates as you type; click Copy output to copy it.
When it helps
- 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
01Basic code snippet (separator ': ')
Inputfunction hello() {
return 'world';
}
Expected result1: function hello() {
2: return 'world';
3: }
02Zero-padded 3-digit numbers (Auto padding off, width 3, separator ': ')
InputLine one
Line two
Line three
Expected result001: Line one
002: Line two
003: Line three
03Tab separator, starting at 10
Expected result10 Apple
11 Banana
12 Cherry
Tips
- Paste a tab character into the Separator field 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?⌄
The Separator is a free text field (up to 16 characters, default '. '). Type a colon, pipe, dash or space, or paste a tab character — pressing the Tab key moves focus instead of typing a tab. 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.
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.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities