Add Line Numbers to Text
Paste a list, a log, a transcript or a block of code and every line gets a number as you type. Choose where the count starts, how far it steps, whether the numbers wear a period, a parenthesis, brackets or a colon, and whether blank lines are counted, skipped or dropped, then copy the result. The same page will take numbers back off again, conservatively, without eating text that merely happens to begin with a digit. Everything runs in your browser: nothing is uploaded, and there is no account, no API and no length limit but your own device.
# is replaced by the number
\t for a tab
Your text stays in your browser. Nothing is uploaded.
What Is an Add Line Numbers Tool?
A line numbering tool takes text that is already split into rows and writes a number in front of each one. That sounds trivial until you have tried to do it by hand in a document with eighty rows, then deleted a paragraph in the middle and discovered that every number below it is now wrong.
The job has two halves. The first is counting: deciding which rows get a number, where the count starts, and how far it jumps each time. The second is formatting: deciding what the number looks like when it lands on the page — bare 7, a list marker 7., a legal-style 7), a citation-style [7], a script-style 7: — and what sits between the number and the words that follow.
Both halves matter more than they look. A numbered list pasted into an email needs 1. and a space. A code snippet shared in a review needs the number to line up vertically, which means zero-padding so that line 9 reads 09 and sits flush with line 10. A transcript needs every physical line numbered, blank ones included, so that a reference to “line 42” means the same thing to two different readers. A shopping list needs the blanks skipped so the numbers stay contiguous on the items.
This tool handles all of those from one textarea. The result updates as you type rather than waiting for a button, so you can see the effect of each option immediately and switch between them until the output reads the way you want.
How to Add Line Numbers to Text Online
There is nothing to install and nothing to sign up for. The whole process is four steps:
- Paste your text. One item per row. The textarea accepts anything — a list, a log, verse, code, a transcript — and splits rows on Windows (
CRLF), classic Mac (CR) and Unix (LF) line breaks alike. - Set the sequence. Start at defaults to 1 and accepts 0 or a negative number. Increment defaults to 1 and accepts any positive or negative step, so you can count 5, 10, 15 or run backwards from 10.
- Choose the look. Pick a number style, a separator, whether to zero-pad, and what should happen to blank lines. The line under the controls restates your current choices in plain words, so you never have to guess what is about to be applied.
- Copy the result. The output pane updates live. Copy Output puts it on your clipboard and confirms; Clear empties both panes; Load Example fills the textarea with a short sample that has a blank line in it, which is the quickest way to see how the blank-line options differ.
If your text arrived as one long wrapped paragraph rather than as rows, join or split it first with Remove Line Breaks and come back. Line numbering can only number breaks that are actually there. If the rows are in the wrong order, Text Sorter & Alphabetizer will rearrange them before you number, which is nearly always easier than numbering first and sorting afterwards.
Line Numbering Options
Start number
Where the count begins. The default is 1, which is what most lists want. Zero is the right answer when you are numbering array indices, offset rows in a spreadsheet export, or matching a language whose counting starts at 0. Negative start numbers are allowed too, useful for a countdown or for a diff where the lines above an insertion point are conventionally numbered −3, −2, −1.
Increment
The gap between one number and the next. Step by 1 for an ordinary list; by 5 or 10 when you are leaving room to insert items later, which is how printed catalogues and legislative clauses stay stable through edits. A negative increment counts downwards. An increment of 0 is not a sequence, so the tool refuses it and falls back to 1 rather than quietly stamping the same number on every row.
Number style
Five presets cover almost everything: 1, 1., 1), [1] and 1:. Plain digits suit code listings and data. A period is the standard ordered-list marker and the one most word processors produce. A closing parenthesis is common in legal and academic numbering. Square brackets read as a reference or a footnote marker. A colon is the convention in scripts, transcripts and log output.
The sixth option is Custom: type any pattern and put a # where the number belongs. Step #: produces Step 1:, Line # — produces Line 1 —, and # of 9 produces 1 of 9. If your pattern has no #, the number is appended to the end of it.
Separator
What sits between the number and the line. A single space is the default and reads naturally. A tab is what you want when the result is going into a spreadsheet or a two-column paste, because the receiving application can split on it. Custom lets you type anything at all — . , – , three spaces to force a hanging indent — and understands \t as a literal tab.
Zero-padding
Without padding, a ten-line list reads 1, 2, … 9, 10, and because 10 is wider than 9 the text after it no longer lines up. Zero-padding fixes the width for the whole block, so the same list reads 01, 02, … 09, 10 and every line starts its content in the same column.
The width is worked out from the numbers you are actually going to produce — the widest one in the sequence, ignoring its sign — not from a guess about the start value. So starting at 0 and running 100 lines pads to three digits (000…099), starting at 995 pads to four, and counting downwards from 12 pads to two. Negative numbers keep the minus sign outside the zeros: -05, never 0-5.
Blank-line handling
Three behaviours, and the choice changes what the numbers mean:
- Skip blank lines (the default) leaves empty rows where they are but gives them no number, so the count runs 1, 2, 3 across the lines that actually hold content. This is what you want for a list or a set of instructions with paragraph gaps in it, because the numbers stay contiguous on the things you are referring to.
- Number blank lines numbers every physical row. Choose this when the number has to agree with something else that counts rows — an editor’s gutter, a log file, a legal document, a spreadsheet export — because a reference to “line 42” then means the same row to everyone.
- Remove blank lines drops empty rows from the output entirely and numbers what is left. It is the fastest way to collapse a loosely spaced list into a tight one.
A blank line here means a row that is empty or holds nothing but whitespace, including tabs and non-breaking spaces. Skipping is the default because it is the behaviour people most often mean when they say “number these lines”. They are thinking about their items, not about the gaps between them.
Common Uses for Line Numbers
Code snippets and reviews
The single most common reason to number lines is so that a conversation about code can point at it. “Line 14 closes the wrong brace” is unambiguous; “near the middle of that function” is not. Numbered listings survive the trip through email, chat and issue trackers, where the receiving editor’s own gutter is not visible. Zero-padding matters most here, because it keeps the code itself in one vertical column.
Documentation and instructions
Numbered steps are easier to follow and easier to refer back to, particularly in a support article or a runbook where a colleague will say “I got as far as step 6”. If you are still drafting, Lorem Ipsum Generator will produce placeholder rows so you can check the numbering and the layout before the real copy exists.
Lists of every kind
Rankings, shortlists, agendas, ingredients, packing lists, Top-10 roundups. Number them, then sort or de-duplicate with confidence: Remove Duplicate Lines is worth running before you number, because removing a duplicate afterwards leaves a hole in the sequence that you then have to renumber.
Scripts, transcripts and subtitles
Transcripts are conventionally numbered by line so that an editor, a translator and a proofreader can all refer to the same row. A colon separator matches the format most transcription tools emit. Number every physical line here, blanks included, or the references will drift out of step with the source.
Teaching materials
Worksheets, reading passages, exam questions, marking keys. Teachers number lines so that feedback can be specific — “look again at lines 3 and 7” — and so that a printed passage can be discussed without anyone having to describe where they are looking.
Reviews, feedback and editing
When you are sending notes on someone else’s draft, numbering their lines lets you attach a comment to each one without quoting it back. Afterwards, Text Compare will show you exactly what changed between the numbered version and the revision, line by line.
Logs and copied text
Text lifted out of a terminal, a console or a spreadsheet often arrives with its own numbering already attached, or with none at all when you need some. Both directions are handled here: add numbers to a raw paste, or strip the numbering that a log viewer added so you can work with the message text on its own.
Removing Line Numbers Without Damaging Your Text
Stripping numbers is the dangerous half of this job, because a line that begins with a digit is not necessarily a numbered line. 1984 was a great year, 3 blind mice, 2025 budget forecast and 1:30 mixing ratio are all content, and a careless tool will happily eat the beginning of them.
So this one is deliberately conservative, in four specific ways:
- A delimiter is required. Only
1.,2),3:and[4]are recognised. A bare number followed by a space is never treated as a line number, which is what protects1984 was a great yearand3 blind miceoutright. - Whitespace is required after the delimiter.
1:30 mixing ratiohas no space after the colon, so it is left alone.1: thirty minuteshas one, so it is a candidate. - The numbers must agree with each other. Every candidate in the block must use the same delimiter and must form a sequence with a single constant step: 1, 2, 3 or 5, 10, 15.
1. Buy milkabove1984. Was a great yeardoes not form one, so neither is touched. - Short blocks have to start at the beginning. With fewer than three candidates there is not enough evidence, so the tool only acts on exactly
1.or exactly1.2.. A lone2024. A great yearis left exactly as it is.
When the tool decides it cannot be sure, it says so instead of guessing, and your text comes back unchanged. Leading indentation is preserved, so a numbered sub-list does not lose its shape, and a line that is nothing but a number and a delimiter — the 2: of a code listing with an empty second line — is handled correctly rather than being dropped.
If the numbering you want gone does not follow a clean sequence — a document where someone renumbered half of it by hand — Find & Replace with a regular expression is the more surgical instrument, and it will let you see every match before anything is changed.
Add Line Numbers Without Uploading Your Text
Line numbering is arithmetic and string concatenation. It needs no model, no server and no database, so this page does all of it in the JavaScript engine that is already running in your browser. Your text goes from the textarea into a local function and back onto the screen. There is no API call, no upload, no queue and nothing stored.
That is worth stating plainly, because the text people number is often not public: unreleased product copy, a contract clause, a patient or client list, an internal incident log, an exam paper before it is sat, a manuscript nobody has seen. Pasting any of that into a web service means trusting that service with it. Here there is nothing to trust. You can confirm it yourself in your browser’s developer tools: typing sends nothing anywhere, because the tool itself never makes a request.
The practical consequences are that the tool works offline, responds on the keystroke rather than after a round trip, has no length limit beyond the memory in your device, and cannot lose your text on a server that you have no access to. Closing the tab is the end of it.
One honest caveat: the text is still in your browser’s memory and, if you copy the result, on your clipboard, the same as with any local editor. What does not happen is transmission.
Add Line Numbers vs Manually Numbering Text
Typing the numbers yourself works for four lines. Beyond that it is slow, and more importantly it is fragile: the numbering is only correct for the document exactly as it stands at the moment you typed it.
Consider what happens when the document changes. Insert a paragraph at position 3 and every number below it is now one too low. Delete two lines near the top and the sequence jumps. Reorder the items — which is the whole point of a ranked list — and the numbers now describe the old order. Each of those edits means reading the whole document again and correcting dozens of figures by hand, with a real chance of missing one and shipping a list that reads 1, 2, 3, 5.
Automatic numbering removes that failure mode entirely, because the numbers are derived from the lines rather than attached to them. The workflow becomes: get the content right first, then number it last, in one pass, and know that the result is consistent by construction. If the content changes, paste it back in and the numbers are regenerated in the same instant.
It is also more consistent in appearance. A human typing twenty numbers will produce 1., 2., 3. and then, without noticing, a 4) and a 5 with no delimiter at all. A tool applies one rule to every line. And where alignment matters — code listings above all — zero-padding is effectively impossible to do by hand once the block passes nine rows, because you cannot know the final width until the last line exists.
The same argument applies in reverse to removal. Stripping twenty numbers by hand means twenty cursor journeys and twenty deletions, with the risk of taking a character of real content with each one. The conservative detector here does it in one pass and, when it is not confident, declines and tells you why.
Line Endings, Long Lines and Other Details
Windows and Unix line breaks. Text from Notepad, PowerShell or an Excel export usually separates rows with a carriage return and a line feed (CRLF); text from macOS, Linux, Git and most editors uses a line feed alone (LF). This tool splits on either, and on the older Mac classic CR as well, so rows from any source are numbered correctly. The output itself is written with LF throughout: that is what a browser hands a script after you paste into a text box, it is the default for Git, macOS, Linux and every modern editor, and Windows editors accept it without complaint.
Very long lines. The output pane wraps rather than scrolls sideways, and long words break, so a minified JSON blob or a 4,000-character log row stays readable. Numbering itself does not care how long a line is; it is one concatenation per row.
Unicode and emoji. Numbers are written in front of the line and the line is copied through untouched, so accented characters, right-to-left scripts, combining marks and emoji all survive exactly. Characters are counted the way your browser counts them in a textarea — by UTF-16 code unit — which means an emoji outside the Basic Multilingual Plane reads as two. If you are checking a numbered block against a hard character limit, Character Counter will count the result accurately, and Word Counter gives you words, sentences and reading time on the same text.
Trailing whitespace. Lines are not trimmed. A row that ends with three spaces keeps them, because in Markdown two trailing spaces are a deliberate line break and in code they can be significant. A row that is nothing but whitespace counts as blank for the blank-line options, and when it is numbered the number is written on its own without a dangling separator after it.
Invalid settings. A start value or an increment that is empty, non-numeric, absurdly large or — for the increment — zero cannot break the page. The tool falls back to a sensible default and says so in the line under the controls, so you can see that your setting was not applied rather than wondering why the output looks wrong.
Frequently Asked Questions
How do I add line numbers to text online?
Paste your text into the box, one item per row, and the numbered version appears in the output pane as you type. There is no button to press and nothing to submit. Choose a number style if you want something other than a bare digit, pick a separator, and press Copy Output when the result looks right. Everything happens in your browser, so it works offline and there is no account, no upload and no length limit.
Can I start line numbering at 0 or another number?
Yes. The Start at field takes any integer: 1 for an ordinary list, 0 for array indices and other zero-based counting, a larger number such as 41 to continue a document that already has forty numbered lines, or a negative number for a countdown or for the convention of labelling lines above an insertion point −3, −2, −1. Whatever you enter, the rest of the sequence follows from it.
Can I choose the increment between line numbers?
Yes. Increment defaults to 1 but accepts any positive or negative integer, so you can number 2, 4, 6, 8 or 5, 10, 15, 20 — which is what printed catalogues and legal clauses do to leave room for insertions later — or count downwards with a negative step. The only value that is refused is 0, because a sequence that never advances is not a sequence; if you enter it the tool falls back to 1 and tells you.
Can I skip blank lines?
Yes, and it is the default. Skip blank lines leaves empty rows exactly where they are but gives them no number, so the count stays contiguous across the lines that hold content: 1, 2, 3 rather than 1, 2, 4. Number blank lines numbers every physical row instead, which is what you want when the number has to agree with an editor’s gutter, a log file or a legal document. Remove blank lines drops empty rows from the output altogether and numbers what remains. A blank line means a row that is empty or holds only whitespace.
Can I add line numbers with brackets, periods or parentheses?
Yes. Five presets are built in — 1, 1., 1), [1] and 1: — covering plain code listings, ordinary ordered lists, legal and academic numbering, references and footnotes, and scripts or transcripts. Beyond those, Custom lets you type any pattern with a # marking where the number goes, so Step #: gives Step 1:, # of 12 gives 1 of 12, and (#) gives (1). The separator between the number and the text is chosen separately, so a bracket style with a tab separator works just as well as a period with a space.
Can I remove existing line numbers?
Yes — switch the mode to Remove Numbers. It strips 1. text, 2) text, 3: text and [4] text, preserving any indentation. It is deliberately conservative: a delimiter is required, so a bare number at the start of a line is never removed, which is why 1984 was a great year and 3 blind mice come through untouched. The candidates must also share one delimiter style and form a sequence with a constant step, and a block with fewer than three of them has to start at 1. When the evidence is not clear the tool changes nothing and explains why, rather than guessing.
Can I zero-pad line numbers such as 01, 02 and 03?
Yes. Turn on Zero-pad under Alignment and every number in the block is written at the same width, so the text after it lines up in a single column: 01. First line, 02. Second line, … 10. Tenth line. The width is calculated from the widest number the sequence will actually produce rather than assumed from the start value, so beginning at 0 and running a hundred lines pads to three digits, and beginning at 995 pads to four. Negative numbers keep the sign outside the zeros: -05, not 0-5. Padding also makes the result sort correctly as text, which plain 1…10 does not.
Is my text uploaded or stored?
No. Numbering is arithmetic and string concatenation, so it needs no server: the whole tool is JavaScript running in the tab you have open. There is no API call, no upload, no database and no copy of your text logged or stored, and you can verify that in your browser’s developer tools: the tool itself never makes a request, so typing sends nothing anywhere. It works with the connection off. That matters when the text is a contract clause, an internal log, an unseen manuscript or an exam paper. The one honest caveat is that the text is in your browser’s memory and, after you press Copy, on your clipboard, exactly as it would be in any local editor. What does not happen is transmission.