ForHosting KIT · Text & AI

Add line numbers to text

Add line numbers to text without opening an editor, writing a script, or correcting uneven prefixes by hand.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Paste any multi-line content, choose a non-negative starting number, and receive a numbered version in which every prefix is padded to the same width. Blank lines remain present and receive numbers too, so the output keeps the exact line structure of the source. The tool is deterministic, works with common newline formats, and returns useful counts alongside the transformed text for straightforward checking and automation.

Turn plain lines into a clear reference

Line numbers make unstructured text much easier to discuss, review, and compare. Paste the source into the text field and set the first number you want to use. The tool treats every segment separated by a newline as a line, including an empty segment between two visible lines and an empty final segment after a trailing newline. It then prefixes each line with its sequential number, a vertical bar, and a space. This stable format gives collaborators an exact reference such as line 8 or line 42 without changing the words that follow the prefix. Windows carriage-return line endings and older carriage-return-only input are normalized to regular newline characters, so output stays consistent across systems. The original spacing inside each line is preserved. Nothing is sorted, trimmed, wrapped, interpreted, or removed. As a result, the numbered text can be pasted into a ticket, review note, lesson, transcript, checklist, or message while retaining the source order and visible blank-line structure.

Start anywhere and keep the numbers aligned

The starting value defaults to 1, but you can choose any non-negative safe integer that leaves enough room for all following line numbers. Starting at 0 is supported, which is useful for zero-based technical indexes, and a later value such as 101 can continue numbering from an earlier excerpt. Negative values are rejected because they do not satisfy the capability contract. Alignment is calculated from the final number: the tool determines how many digits that number needs, then left-pads every shorter prefix with spaces. If a list begins at 8 and ends at 12, for example, the single-digit numbers receive one leading space while 10, 11, and 12 do not. The separator bars therefore form a straight visual column. This matters when a range crosses 9, 99, or another digit boundary. The result also reports the actual start, end, line count, and padding width, making it easy for an automated caller to verify the transformation without parsing the output again.

Use the result safely in repeatable workflows

Numbered text is useful whenever people need to refer to precise parts of content that has no permanent editor coordinates. Support teams can quote a log excerpt and ask about a specific line. Teachers can prepare a poem or passage for classroom discussion. Editors can annotate a draft in a channel that does not display native line numbers. Developers can number configuration samples, command output, or test fixtures before sharing them in an issue. For automation, send the same text and starting number through the API and receive the same result every time; a request costs $0.002. Processing is analytic and local to the execution path: it does not call an AI model, fetch remote resources, consult the current time, or use randomness. Treat the returned text as a presentation copy rather than as a reversible encoding, because the new prefixes become part of the text. Keep the original source when you may later need an unnumbered version. If a chosen range would exceed JavaScript’s safe integer limit, the tool rejects it instead of emitting misleading numbers.

Review logs with a teammate

Add stable references to a pasted log excerpt so comments can identify exact lines without relying on screen position.

Continue an existing excerpt

Choose a later starting number to number the next section of a document or transcript without restarting at one.

Prepare teaching material

Number every line of a passage, including deliberate blank lines, for clear classroom questions and annotations.

How much does it cost?

The API costs $0.002 per request. You can also run the browser version on this page.

Can numbering start at zero?

Yes. Zero and any other valid non-negative starting integer are accepted.

What happens to blank lines?

Every blank line is preserved and receives its own sequential number, including a final blank line created by a trailing newline.

How are line numbers aligned?

Shorter numbers are padded on the left to match the digit width of the final line number, placing every separator in one column.

Does the tool change the original line content?

No. It normalizes newline characters and adds prefixes, but it does not trim, sort, wrap, or rewrite content within each line.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/text/add-line-numbers

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/text/add-line-numbers \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"First task\nSecond task\nThird task"}'
{
  "text": "First task\nSecond task\nThird task"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.add_line_numbers",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →