Skip to content
UniKit

Text line sorter

Sort multi-line text line by line with locale-aware comparison, so Chinese sorts by pinyin, in ascending or descending order and with blank lines ignored.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Paste multi-line text (one item per line)

List items

Drag the handle at the start of a row to reorder it, or use ↑ ↓ to nudge and “Remove” to delete; changes show up in the result immediately.

Paste multi-line text to see the list and the sorted result

Items: 0

Sort settings

Sorted result

The result is the current list order (after dragging, moving, or removing rows) with the chosen direction applied; blank lines are dropped and each line is trimmed.

Paste multi-line text to see the list and the sorted result

Items out: 0 · Blank lines ignored: 1 · Duplicates removed: 0 · Direction: keep

What this tool does

  • Drag pasted to-dos, name lists or categories into the order you want, then re-sort by pinyin, leading number or length and export clean text lines.
  • Tidy up messy pasted lists: blank lines and leading/trailing spaces are removed, one click removes duplicates (first occurrence wins), and the export can be prefixed with 1. 2. 3.
  • Sort lists whose lines start with numbers — sorting by leading number puts 10 after 2, unlike a plain text sort where 10 comes first.

Example

Input

上海
北京
广州

Output

北京
广州
上海

The example uses ascending order with locale-aware comparison, so the Chinese lines sort by pinyin (Beijing → Guangzhou → Shanghai). The default direction is “keep list order” (only trimming, blank-line removal and manual dragging); switch the comparison to “locale” for pinyin ordering.

Frequently asked questions

Does dragging conflict with automatic sorting?

No. The list order produced by dragging, moving, removing and appending is always kept, and the sort direction is applied on top of it: “keep list order” exports it as is while ascending or descending re-sorts it. The sort is stable, so items that compare equal keep the relative order you dragged them into.

What does each comparison mode do?

Unicode code point compares the raw string (case-sensitive unless “ignore case” is on); Locale uses localeCompare (zh-Hans-CN), giving pinyin order for Chinese and alphabetical order for English; Leading number reads the number at the start of a line (negatives and decimals included) and puts lines without a number after all numbered lines; Character count compares by Unicode code points so an emoji counts as one, falling back to code-point order on ties.

How are blank, padded and duplicate lines handled?

Blank (or whitespace-only) lines are dropped and counted under “blank lines ignored”; each line is trimmed; identical lines are kept only once when “remove duplicates” is checked, and the number removed is reported in the stats. Spaces inside a line are left untouched.

Is there a size limit?

There is no hard limit: sorting and editing are plain array operations (one pass or one stable sort), so a few thousand lines finish within a frame. Every item is rendered as a DOM row though, so dragging becomes sluggish above roughly ten thousand rows — sort first, then copy the result out.

Is my text uploaded?

No. Parsing, sorting and exporting all happen in browser memory with no network requests and no server-side log.

Keywords:text sort

Related tools