ForHosting KIT · Text & AI

Reverse line order

The lines “first line”, “second line” and “third line” come back as “third line”, “second line”, “first line”: the order flips, while each line stays readable left to right. Blank lines and indentation move along. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
first line second line third line
You get
Result
third line second line first line
Line count
3

When a log, list, or paste arrives with the newest entry at the bottom and you need the opposite, reversing line order is faster than rewriting the file by hand. This capability takes multi-line text, keeps every line’s content intact—including blank lines and surrounding spaces—and returns those lines from last to first. It accepts Unix LF, Windows CRLF, and classic Mac CR endings, normalizes the output to LF, and restores a trailing newline when the input had one.

What reverse line order actually changes

Reversing lines is not the same as reversing a string character by character. Each line stays readable left to right; only the sequence of lines is flipped so the former last line becomes the first. That distinction matters for logs, changelists, CSV-like row dumps without a header, poetry stanzas, and any paste where people think in rows rather than bytes.

Blank lines count as lines: if you intentionally left a gap between blocks, that gap moves with the reverse and is not stripped. Leading and trailing spaces inside a line are preserved so indentation and padded columns survive. The tool does not sort alphabetically, deduplicate, trim, or rewrap text; it only reorders.

Because the work is pure local parse logic, the same input always produces the same output, with no model, network call, or locale table involved.

Line endings, trailing newlines, and empty input

Real-world text rarely uses a single newline style. Editors, shell redirects, and email clients mix LF, CRLF, and occasionally bare CR. On input this capability splits on any of those sequences so mixed dumps still reverse correctly.

The rejoined result uses LF between lines for a stable, portable representation across platforms. If the original text ended with a newline, the result ends with a newline as well; if it did not, neither does the result—so tools that treat a final newline as a file-shape detail keep that shape. Extremely large pastes are bounded by a character limit so memory use stays predictable on the edge worker and in the browser.

Where reverse line order fits in real workflows

Support engineers reverse log tails so the newest stack frame sits at the top before pasting into a ticket. Writers reverse draft outlines when a brainstorm was captured bottom-up and the published structure should read top-down. Data practitioners flip a small multi-line export before a tool that assumes newest-first rows.

The response reports the reversed text, how many lines were processed, and whether a trailing newline was restored—enough metadata to assert behavior in automated checks without re-parsing the body.

Newest-first log paste

Flip a chronological log so the latest events appear first before sharing a support snippet or incident note.

Outline and list reorder

Turn a bottom-up brainstorm list into a top-down outline without rewriting each bullet by hand.

Does it reverse characters inside each line?

No. Only the order of lines changes. Text within a line stays left-to-right exactly as submitted.

What happens with blank lines?

Blank lines are real lines and move with the reverse. They are not stripped or collapsed.

Which line endings are accepted?

LF, CRLF, and CR on input. Output joins lines with LF and restores a trailing newline only if the input had one.

What if the text is empty?

Missing or non-string text also fails. Failed validation is not charged.

How do I put the newest log entries at the top?

Paste the log as it is, with the oldest entries first. The last line becomes the first, so the most recent event sits at the top, ready to paste into a ticket, and every line stays intact.

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/str/reverse-lines

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/str/reverse-lines \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"first line\nsecond line\nthird line"}'
{
  "text": "first line\nsecond line\nthird line"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.reverse_lines",
  "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.

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.

Empty input is rejected with invalid_input so pipelines fail loudly instead of inventing an empty success. The same deterministic path powers the free browser form and the API at $0.002 per successful request.

Line endings, trailing newlines, and empty input

An empty string, missing text field, or non-string text fails immediately with invalid_input and a clear message. That rule prevents silent no-ops in jobs that accidentally pass blank bodies after a failed download or an empty template expansion. Use the free form for one-off flips; wire the API when a pipeline needs the same contract every time.

Where reverse line order fits in real workflows

Because successful API calls cost only $0.002 and failed validation is not billed, you can probe empty or malformed payloads without draining prepaid balance. Drop the call into a shell script, a CI step, or a help-desk macro: anywhere people currently open an editor and drag the last line to the top. Tier-A parse work keeps latency low and removes the need for a container or language model on every request.

Test fixture generation

Produce deterministic reversed multi-line fixtures for unit tests that assert row order after a transform.

How much does the API cost?

$0.002 per successful request. The browser tool is free. Invalid input is not charged.

Read the full KIT documentation →