Add Line Numbers to Text Online
Add line numbers to any text in seconds — paste your lines, pick a format like 1., 1) or [1], and the numbers appear in front of every line. You can just as easily add a static prefix such as a bullet, dash, or quote marker instead of a number.
It works with code snippets, lists, notes, citations, or any plain text. Developers number lines for code reviews and docs, writers and teachers build outlines and numbered references, and legal teams mark up lines for easy cross-referencing.
How to Add Line Numbers
Enter your text
Paste or type your text into the Input panel — each line is processed separately. Use the Paste button to pull text straight from your clipboard.
Choose a format
Type a format in the Format field using $n as the placeholder for the line number, or tap a Preset like $n., Bullet point, Dash, or Quote. A format without $n adds the same prefix to every line.
Adjust the settings
Set the Start number, choose Padding to align numbers, switch Order between ascending and descending, place numbers as a Prefix or Suffix, and turn on Skip Empty to leave blank lines untouched. Number-only options appear when your format uses $n.
Copy or download
The Output updates live as you type. Use Copy to send the result to your clipboard, Download to save a .txt file, or Swap to move the output back to the input for another pass.
Features
Numbered Line Formats
Use $n to add an auto-incrementing number to every line — $n., $n), [$n], #$n, or Line $n:.
Static Prefixes
Add the same marker to every line with built-in Bullet point, Dash, and Quote presets, or your own characters.
Custom Patterns
Build any format you like, mixing text, symbols, Unicode, and the $n placeholder — even more than once per line.
Custom Start Number
Begin numbering from any value — continue a list, start at zero for code, or pick up where another section left off.
Ascending or Descending
Number lines top-to-bottom or count down with the Order option for reverse lists and countdowns.
Number Padding
Add leading or trailing spaces so numbers line up neatly — right-align with Left or left-align with Right.
Prefix or Suffix
Place the number or marker at the start of each line as a Prefix, or at the end as a Suffix.
Skip Empty Lines
Leave blank lines untouched so your spacing between paragraphs stays clean instead of getting prefix-only lines.
Live Preview & Stats
The output refreshes instantly as you type or tweak settings, with counts of total, processed, and skipped lines.
Swap & Export
Swap the output back to the input for layered passes, then copy to your clipboard or download a .txt file.
Frequently Asked Questions
How do I add line numbers to text online?
Paste your text into the Input panel, pick a numbered format such as $n. (or tap a preset), and the numbers appear in the Output instantly. Then copy or download the result. There is nothing to install or sign up for.
What does $n mean in the format?
$n is the placeholder for the line number. With a format of Line $n: the output becomes "Line 1:", "Line 2:", and so on. You can even use $n more than once — [$n-$n] produces "[1-1]", "[2-2]". A format without $n simply repeats the same prefix on every line.
How do I start numbering from a custom number?
Set the Start field to any value — for example 0 for code or 100 to continue a longer list. The Start option appears whenever your format contains $n.
What number formats and prefixes can I use?
Anything you type. Common numbered formats are $n., $n), [$n], and #$n. For static markers, use the Bullet point, Dash, or Quote presets, or type your own — including Unicode symbols and emoji.
Can I skip empty lines when numbering?
Yes. Turn on Skip Empty and blank lines keep their blank spacing without receiving a number or prefix. Turn it off and every line, including empty ones, gets the prefix.
Can I number lines in reverse or place the number at the end?
Yes. Use the Order option to count down in descending order, and the Position option to add the number or marker as a suffix at the end of each line instead of as a prefix.
How does Padding work?
Padding adds spaces so numbers of different widths line up. Left right-aligns the numbers (" 1", " 10", "100"), Right left-aligns them ("1 ", "10 ", "100"), and None leaves them as-is.
What is the Swap button for?
Swap moves the output text back into the input so you can apply another pass. For example, add line numbers with $n., swap, then add a > quote prefix to get "> 1. First line", "> 2. Second line".
Does it work for code as well as plain text?
Yes. It treats every line the same, so it handles code snippets for reviews and documentation just as well as prose, lists, and notes. There is no strict size limit, but for the smoothest performance keep texts under about 10,000 lines since everything is processed in your browser.
Is my text private?
Completely. All processing runs locally in your browser with JavaScript, and your text is never sent to any server. After the page loads you can even use the tool offline.
No comments yet. Be the first to comment!