Text Tools

Number each line of pasted text

Add Line Numbers prefixes each line of pasted text with its position (1:, 2:, 3:) as you type, blank lines included. Developers use it to cite exact lines when reviewing a snippet or referencing a stack trace in an issue, and writers number checklist or questionnaire items before sharing. Set "Start at" to begin from another number. A trailing newline counts as an empty final line and gets its own number.

How to use Add Line Numbers

  1. Open Add Line Numbers in the Toolbox101 app.
  2. Paste the code, log or list into the Lines box.
  3. Change Start at if the first line should not be 1.
  4. Read the numbered text in the Output box; every line starts with 1:, 2:, 3: and so on. Click Copy to paste it into an issue, review or chat.

Worked example

Add Line Numbers returns the output below for this input.

Input

const x = 1;
let y = 2;
console.log(x + y);

Output

1: const x = 1;
2: let y = 2;
3: console.log(x + y);

Check it yourself: open Add Line Numbers and enter the same input.

Frequently asked questions

How does the tool handle blank lines?

Every newline-separated segment is a line and receives a number, blank lines included. Text with an empty line in the middle numbers it like any other line, so a blank second line comes out as 2: with nothing after the colon, useful when the layout must stay visible.

Can I start numbering from a different number?

Yes. Set Start at to any whole number, such as 10 to continue from an earlier excerpt or 0 for zero-based numbering. The default is 1, which matches text editors, diff tools and compiler messages.

Can I remove the numbers again afterward?

This tool only adds numbers. There is no unnumber mode. The original text stays in the Input box, so copy it from there before you replace anything; pasting the output back through the tool numbers it a second time rather than undoing the first pass.

Use Add Line Numbers now

Runs in your browser. Nothing you type is uploaded.