To add line numbers in Microsoft Word, open the document, switch to the Layout tab on the ribbon, click Line Numbers inside the Page Setup group, and pick a style such as Continuous, Restart Each Page, or Restart Each Section. Word then prints sequential integers next to each line in the chosen scope and updates those numbers automatically as you edit, insert, or delete content. That built-in path is the right answer when the numbered output needs to live inside the .docx itself as live, re-flowing indicators that survive reformatting and reflow across pages.

For plain text that will leave Word, be processed by other tools, or be shared as a numbered transcript, code reference, or script draft, a different approach is faster. Paste the lines into a dedicated browser-based line numbering tool, set a starting value, separator, and optional leading-zero padding, and download a UTF-8 plain text file with the numbers already baked into each line. Both paths solve real problems, and most writers end up needing both at different points in a workflow.

how to add line numbers in word
how to add line numbers in word

Where Line Numbers Come in Handy

Line numbers do three useful jobs in a document. They give reviewers and collaborators a stable reference so a comment like "fix the typo on line 142" points to one specific spot rather than a moving target that shifts as paragraphs reflow. They anchor legal transcripts, deposition excerpts, and courtroom filings where every spoken line needs a citable identifier that opposing counsel can quote back. And they help in code-review sheets, classroom handouts, stage scripts, poetry drafts, and long support logs where scrolling back to find a passage wastes more time than the original read.

The same logic applies whether the final file is a Word document, a Markdown transcript, a TXT log, or a printed handout. What changes is the mechanism. Word renders numbers in the margin as part of the document layout, while a plain-text tool bakes the numbers directly into each line so the output is portable to any other program that reads text. Once you decide where the numbered file will live, choosing between Word's built-in feature and a browser-based tool becomes much easier.

Built-in Line Numbering in Microsoft Word

Microsoft Word has shipped a line-numbering option for many versions, including Word 2007, Word 2013, Word 2016, Word 2019, Word 2021, Word 2024, and the Microsoft 365 subscription editions. The path is similar across these versions, although the tab name has changed over time.

Follow these steps to add line numbers to a Word document:

  1. Open the document and place the cursor anywhere inside the body text.
  2. Switch to the Layout tab on the ribbon. In older versions this tab is labelled Page Layout.
  3. In the Page Setup group, click Line Numbers. A drop-down menu appears.
  4. Pick one of the built-in styles: Continuous numbers every line from start to finish, Restart Each Page resets the count at the top of every page, Restart Each Section resets at every section break, and Suppress hides line numbers for the current paragraph.
  5. To fine-tune the placement, distance from text, and starting value, choose Line Numbering Options from the same menu and use the dialog that opens.

Once enabled, Word updates the numbers automatically as you type, delete, or rewrap paragraphs. You can exclude specific paragraphs, such as headings or pull quotes, by selecting them, opening the Paragraph dialog from the Line Numbering Options menu, and ticking Suppress line numbers. To remove the numbers later, return to Line Numbers and choose None.

This is the best fit when the numbered output is meant to stay inside the .docx file as live indicators that travel with the document. It is less suitable when you need the numbers in a TXT file, an email, a CSV, a chat message, or any destination that does not preserve Word's page-layout metadata.

When a Browser Text Tool Is the Better Fit

A browser-based tool is the better choice in several common situations. You may want to number lines of code before pasting them into a pull-request comment, where Word's margin numbers would not survive. You may be cleaning up a support log that arrived as plain text and need stable identifiers before sharing it with a vendor. You may be drafting a script or a poem and want the line numbers to be part of the file itself, not a side annotation. Or you may need a quick transcript numbering for an interview that will live in TXT, Markdown, or PDF.

The Add Line Numbers to Text tool handles each of these cases without installing software. It accepts up to 1,000,000 characters, lets you pick a starting number between 0 and 999999, choose any separator up to 20 Unicode characters, and optionally pad numbers with leading zeros so the column stays aligned. The numbering, preview, and TXT download all happen locally in the browser, so the source text is not uploaded anywhere. Because the numbers are inserted as literal characters in front of each line, the output behaves like any other text file and can be pasted into Word, an email, a code editor, or a spreadsheet cell.

For a deeper walkthrough of the same tool aimed at exactly this task, the guide How Do I Add a Number to Text on Every Line covers the same workflow from a slightly different angle.

How to Number Every Line of Plain Text

The workflow below turns a block of pasted text into a numbered plain-text file in three short steps.

  1. Paste or type the source text. Open the tool and drop your lines into the input area. The tool accepts Windows CRLF, classic Mac CR, and Unix LF endings, so copied text from Notepad, TextEdit, or VS Code all work without pre-cleaning.
  2. Set the starting number, separator, and padding. Choose a starting integer from 0 to 999999, type a separator such as a period and space, a colon, a vertical bar, or a tab, and decide whether to pad numbers with leading zeros so the column width matches the longest number in the output.
  3. Generate the result, preview it, and download the file. Click Add line numbers to render the numbered text in the preview pane, confirm that every line, including blank ones, looks correct, and then download the result as a UTF-8 plain-text file with no byte-order mark.

The preview is the exact string that will be written to the downloaded file, so spaces, tabs, and line breaks stay inspectable before you commit. If you change a setting afterward, the previous result is cleared automatically and its download link revoked, so a stale file cannot be mistaken for current output.

Setting the Starting Number, Separator, and Padding

The starting number must be a whole non-negative integer with at most six digits. If you need the first line to read 1, enter 1. If you would rather start at 0, or at 100 because the text is a continuation of an earlier file, enter those values directly. The sequence then increases by one for each logical line, including blank and whitespace-only lines, so the numbering always reflects the original line structure.

The separator sits between the generated number and the original line. Common choices include a period and space ("1. The quick brown fox"), a colon ("1: The quick brown fox"), a vertical bar ("1 | The quick brown fox"), or a tab character pasted directly from your keyboard. The separator is treated as a literal string and is not interpreted as a regular expression, so pipes, dots, and other punctuation stay exactly as entered. The maximum length is 20 Unicode characters, which leaves room for short labels such as "L " or "(line) ".

Leading-zero padding aligns the column by widening every number to the digit count of the final number in the sequence. Starting at 8 with three lines produces 08, 09, and 10. Starting at 1 with nine lines leaves the numbers at their natural one-digit width because the final value is still one digit. Turning padding off always renders each number at its natural width. Padding affects only the numeric prefix; the original line text is never padded, trimmed, or otherwise modified.

What the Tool Preserves and What It Doesn't

The tool numbers every logical line and leaves the original text untouched between separators. It does not trim line content, collapse repeated spaces, or reinterpret tabs. Whitespace-only lines are kept and numbered, so the count of lines in the output always matches the count of input lines. A trailing newline in the input produces a final empty logical line that is also numbered, which keeps the positional relationship between numbers and the original sequence intact.

What the tool does not do is equally important to understand. It does not count only non-empty lines, preserve the original mix of CRLF, CR, and LF bytes (the output always uses LF), renumber an existing numbered list intelligently, or add page numbers. It does not apply rich formatting, syntax highlighting, or column alignment; the result is plain UTF-8 text with no byte-order mark. If you need to count lines without transforming them, the Line Counter tool gives you totals for total, non-blank, and blank lines in one view.

The splitting rule that recognizes CRLF, CR, and LF boundaries while keeping trailing empty lines is the standard string-split behavior documented in the MDN String split reference, and the download is built from a local UTF-8 text Blob as described in the MDN Blob documentation.

For workflows that need more than numbering, two companion tools cover the most common neighbours. Add Prefix and Suffix to Lines wraps arbitrary text around every line, and Remove Duplicate Lines keeps only the first occurrence of each line while leaving the retained text exactly as it was.

Side-by-Side: Word's Feature vs. a Plain-Text Tool

Both approaches add line numbers, but they differ in where the numbers live and how portable the result is. The table below summarizes the practical differences so you can pick the right tool for the job.

AspectMicrosoft Word built-inAdd Line Numbers to Text
Output formatNumbers in the margin of a .docx fileNumbers baked into a .txt, .md, or any text file
Updates as you typeYes, automaticNo, regenerates from current input on demand
Starting numberSet in Line Numbering OptionsAny whole non-negative integer up to 999999
Separator styleFixed distance from textAny literal string up to 20 Unicode characters
Leading-zero paddingNot availableWidth follows the longest number in the sequence
Blank linesNumbered by default, suppressible per paragraphAlways numbered to preserve line structure
PrivacyProcessed inside WordProcessed in the browser, text is not uploaded
Best forLive documents that stay in .docxTranscripts, logs, code, scripts, and any portable text file

Most people who work with long documents end up using both. Word's feature keeps the master .docx readable for review, and a plain-text tool produces a numbered companion file for chat, email, code review, or printed handouts. The browser-side approach is also handy when a colleague without Word needs the numbered output, since a UTF-8 TXT file opens in any editor on any operating system.