How to use Add Line Numbers
Add line numbers to any text or source code entirely in your browser — nothing is uploaded to a server. Choose the starting value, align the numbers with zero- or space-padding, and pick the separator that goes between each number and its line (a period, colon, parenthesis, or tab). A reverse mode strips existing numbers back out, so you can clean up pasted snippets or renumber a list in seconds.
- Select "Add numbers" to prefix each line, or "Remove numbers" to strip an existing numbering scheme.
- Paste or type your text into the input area — every newline becomes a numbered line.
- Set the starting number (for example, 0 for offsets or 100 to continue an existing list).
- Choose a padding style — None, Zero (01, 02) or Space ( 1, 2) — to keep numbers aligned in monospace output.
- Pick a separator (period, colon, parenthesis, or tab) and copy or download the numbered result.
Your data never leaves your device — 100% private processing.
Padding and alignment for monospace output
When a list crosses from single to double digits, unpadded numbers leave a ragged left edge — "9." sits one character narrower than "10.". Zero-padding pads every number to the width of the largest value (01, 02 … 12) so columns line up and the result sorts correctly as text. Space-padding does the same visually ( 1, 2 … 12) without altering the numeric characters, which is ideal for code listings, transcripts, and numbered references displayed in a monospace font. The tool computes the required width from the final line number automatically.
| Padding | Line 1 | Line 12 |
|---|---|---|
| None | 1. text | 12. text |
| Zero | 01. text | 12. text |
| Space | 1. text | 12. text |
Removing line numbers from pasted snippets
Code copied from documentation, blog posts, terminals, or PDF exports frequently arrives with line numbers baked into every line — "1. ", "2: ", "3) " or a tab-separated index. The remove mode applies a tolerant pattern that strips an optional leading space, one or more digits, and a common separator character (period, colon, parenthesis, hyphen, tab, or space) from the start of each line. Lines that do not begin with a number are left untouched, so prose mixed with numbered items survives intact. This makes it easy to paste a numbered snippet, strip the prefixes, and recompile or re-run the clean code.
Worked examples
Number lines
Inputs: two lines · start 1 · period separator
Result: 1. line one / 2. line two
Zero padding
Inputs: 12 lines · zero-pad
Result: 01. … 12.
Remove numbers
Inputs: "1. text"
Result: text
Glossary
- Line number
- A sequential index prefixed to each line of text, typically starting at 1, used to reference specific lines in code reviews, logs, and documentation.
- Zero padding
- Filling a number with leading zeros to a fixed width (01, 02) so values of different magnitudes align and sort consistently as text.
- Separator
- The character or characters placed between a line number and its content — commonly a period, colon, parenthesis, or tab.
- Monospace font
- A typeface in which every character occupies the same horizontal width, making padded line numbers align into clean columns.
- Offset start
- Beginning the numbering from a value other than 1 — for example 0 for array indices, or 100 to continue an existing numbered list.
Related reading
Frequently Asked Questions
Why use Add Line Numbers?
- Zero-padding and space-padding keep numbers aligned in monospace output regardless of how long the list grows
- Configurable starting value supports offset numbering, zero-based array indexing, or continuing an existing sequence
- Remove-numbers mode strips existing numeric prefixes with a tolerant pattern that handles mixed separators
- Custom separator choices — period, colon, parenthesis, or tab — match the convention of any target format
Common use cases
- Add reference line numbers to a code snippet before sharing it in a pull request review comment
- Number a set of interview questions before exporting them to a PDF handout for interviewers
- Strip line numbers baked into code copied from a documentation site before running or editing it
- Renumber a list after inserting new items to maintain sequential references in a specification document
- Add zero-padded line numbers to a filename list so it sorts correctly when treated as alphabetical text
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Text Tools
Text Repeater
Repeat any text a set number of times, with optional separators and new lines. Great for testing and templates. Free and private.
NATO Phonetic Alphabet Converter
Convert text into the NATO phonetic alphabet (Alpha, Bravo, Charlie). Spell names, codes, and numbers clearly over the phone or radio. Free and private.
ROT13 / Caesar Cipher
Encode and decode text with ROT13 or any Caesar cipher shift. Classic letter-rotation cipher in your browser. Free and private.
Text to Handwriting
Convert typed text into realistic handwriting and download it as an image. Choose pens, paper, and ink color. Free and private.
Sort Text Lines
Sort lines of text alphabetically, numerically, or reverse. Case-insensitive option, remove duplicates, and trim whitespace. Free online line sorter.
Remove Line Breaks
Remove line breaks and paragraph breaks from text online. Replace breaks with spaces, keep paragraphs, and strip extra spaces. Free and private.
Explore all Text Tools.