ForHosting KIT · Text & AI

Sort lines descending

banana, apple, Cherry and apricot come back as banana, apricot, apple, Cherry: 4 lines from Z to A, with lowercase ahead of capitals by default. Blank lines and lines of spaces stay part of the list. 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
banana apple Cherry apricot
You get
Text
banana apricot apple Cherry
Lines
banana, apricot, apple, Cherry
Quantity
4
Order
desc

Reverse alphabetical line sorting is the job people mean when they search for sort lines descending, Z to A list, or reverse ranking of names without opening a spreadsheet. This capability accepts non-empty multiline text, splits it on carriage return, line feed, or CRLF pairs, then reorders every line from Z down to A with an optional case-insensitive fold so Apple and apple group together under that descending order.

What descending line sorting means and when to use it

Descending alphabetical line sorting answers a search people type every day: sort lines descending, put this list Z to A, reverse the ranking from highest letter to lowest, or flip a glossary so Z comes first without rewriting each row. This tool defines a line as a segment between line terminators. Terminators are carriage return, line feed, or the Windows-style carriage-return-plus-line-feed pair treated as a single break so a CRLF file is not double-split into empty rows.

After splitting, every segment participates in the reverse sort, including blank lines and lines that are only spaces, because blank rows still have a position in a file and many editors keep them when you choose a reverse alphabetical order. Case-insensitive mode folds each line with Unicode default lowercasing before comparing, then tie-breaks on the original string and original index so the result stays stable when folds match.

Prefer this sort-lines-descending calculator when the intent is plain Z–A over pasted text, README lists, reverse rankings, leaderboard name dumps, or log snippets that should read from Z first.

Reverse rankings and leaderboards

Editors paste unsorted names or scores as labels and sort Z–A so reverse rankings or last-letter-first review lists appear without a spreadsheet formula.

Glossary and packing-list Z-first cleanup

Teams reverse-alphabetize bullet lines before release notes, packing lists, or inventory pastes that should start at Z without opening a desktop sort plugin.

What happens if text is empty?

A zero-length string is rejected and not charged; you must send at least one character of text.

Does case-insensitive descending sort treat Apple and apple as equal?

Ties break on the original string and original position for a stable result.

Is the sort lines descending calculator free?

The browser tool runs free on your device.

How is this different from reversing line order?

This capability sorts lines reverse-alphabetically (Z–A). Reverse line order flips top and bottom without comparing letters. Locale-aware collators and ascending A–Z general sort are separate products and search intents.

Why does Cherry end up at the bottom?

In Z to A order, lowercase letters rank above capitals by default, so a line starting with a capital sinks to the end. Turn on the option that ignores case and Cherry rises to the top, ahead of banana.

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/sort-lines-descending

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/sort-lines-descending \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"banana\napple\nCherry\napricot"}'
{
  "text": "banana\napple\nCherry\napricot"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.sort_lines_descending",
  "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.

The response returns both a joined text block ready to copy and a structured lines array for APIs, plus counts and echoed options you can pin in tests. Empty input fails with invalid input so pipelines never store blank payloads by accident.

What descending line sorting means and when to use it

Do not use it when you need ascending A–Z as the primary mode, locale-aware collation with accents, natural numeric order such as item 12 before item 2, or an array API with BCP-47 locale tags—those are different products and different search intents.

Input contract, empty rejection, and reading the response

Trailing newlines produce a trailing empty segment that sorts among other lines by reverse string order, matching how many editors expose an extra empty row at the end of the file when reverse-sorting. Send a JSON body with the required string field text set to the non-empty sample you want sorted reverse-alphabetically. Aliases input, value, s, content, body, and lines are accepted when older clients or form generators use those names. Missing text, a non-string value, or a zero-length string all raise invalid_input with a message that names the problem, and those failures are not charged on the prepaid API. There is no order parameter because this landing is dedicated to descending Z–A only; the response always echoes order as desc so UIs and tests can assert the contract without re-reading the request. Optional case_insensitive is a boolean defaulting to false; aliases ignore_case and ci work the same way. On success the response includes text as the sorted lines joined with a single line feed character, lines as the ordered array of segments from Z toward A, and count as the number of segments after the split so you can assert length without re-parsing. case_insensitive echoes the effective option after defaults, original echoes the exact input for before-and-after displays, and method is always sort_lines_descending so downstream code can branch without sniffing shapes. Use text when a human or clipboard needs one paste-ready block; use lines when an SDK will map each row into a table or database insert. Keep payloads to ordinary message and document sizes suitable for a Worker isolate rather than multi-megabyte dumps; this product is a text utility, not a bulk file warehouse.

API usage, pricing, workflows, and practical limits

Call the free in-browser sort lines descending tool for reverse rankings, Z-first glossaries, packing lists that should end with A, name lists for last-letter-first review, changelog bullets that need Z–A cleanup, and quick reverse-alphabetical checks without installing a desktop editor plugin or writing a one-liner in every language. A typical workflow pastes unsorted product names, sorts descending case-insensitively, then copies the joined text field back into a spreadsheet or markdown table so Z-leading brands appear first. Do not expect deduplication, natural numeric order, or language-specific accent rules here—those are separate problems with separate SEO terms. Use the prepaid KIT API when a CMS, content pipeline, QA harness, or mobile client needs the same contract under balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with line counting when the next step is reporting how many rows you reverse-sorted, but keep sort lines descending as its own landing so the sort-lines-descending search intent is not mixed with reverse physical line order, locale list collation, or full spreadsheet sort. Authors shipping SDKs can document text as the only required field, show a multi-line success example with case_insensitive true, and include an empty-string error example so integrators see both sides of the contract.

CI fixtures for descending text pipelines

Build scripts pin reverse-alphabetical golden outputs so CRLF mishandling, empty-input regressions, or broken case folds fail continuous integration immediately.

How do I sort lines descending with this tool?

Send JSON with text set to your non-empty multiline string. Optionally set case_insensitive to true or false. The response returns Z–A sorted text, a lines array, count, and order set to desc.

Read the full KIT documentation →