Line Sorter & Deduplicator

Sort, reverse, trim, clean, and deduplicate lists of lines locally in your browser.

Runs locally in your browser. No account required.

Practical usage guide

What this tool does

Line Sorter processes plain text as an ordered list of physical lines. It can sort, keep only the first occurrence of each line, combine de-duplication with sorting, or reverse the current line order. Processing stays in the browser and line endings are normalized from CRLF to LF in the output for predictable copying and comparison.

Options define what counts as the same line and how ordering works. Case-sensitive comparison distinguishes uppercase and lowercase text, numeric mode compares numeric-looking values as numbers, trimming can remove surrounding whitespace before processing, and empty-line removal discards blank results. Sorting uses a fixed English collation behavior so the same options are not silently changed by the browser display language.

Quick start

Choose one line operation

Use Sort to reorder all lines, Unique to preserve the first representative of each value, Sort + Unique to retain one representative and then order the result, or Reverse to flip the current sequence without lexical sorting.

Define comparison rules

Choose ascending or descending order for sorting, decide whether letter case matters, and enable numeric comparison only when lines or their leading values are intended to behave as numbers.

Apply cleanup deliberately

Trim Lines removes leading and trailing whitespace before comparison and output. Remove Empty drops blank lines. Leave both disabled when whitespace and empty records carry meaning.

Review what de-duplication retained

Unique operations keep the first occurrence under the selected comparison settings. With case-insensitive or trimmed comparison, later differently cased or spaced variants may be removed.

Common use cases

Normalize configuration lists

Sort feature names, package identifiers, environment keys, domains, or allowlist entries before reviewing a small configuration change.

Remove repeated imported values

Keep the first occurrence of copied IDs, tags, email-like values, labels, or paths before pasting the cleaned list into another local workflow.

Order numeric line values

Sort ports, counters, version components, sizes, or integer test values numerically rather than obtaining the lexical order 1, 10, 2.

Reverse a short event sequence

Flip copied chronological lines so the newest or oldest entry appears first while preserving the contents of each individual line.

Limitations and important notes

Text sorting uses fixed English semantics

The order is not bytewise, code-point-only, or tailored to every language. Accents, punctuation, mixed scripts, and locale-specific alphabet rules may appear in an order different from a native-language directory.

De-duplication keeps the first representative

The tool does not merge metadata or choose the longest, newest, or most complete variant. Under case-insensitive or trimmed comparison, the first matching line supplies the retained text before any requested sort.

Trimming and empty removal change data

Leading spaces can be meaningful in code, Markdown, fixed-width records, or hierarchy. Empty lines can separate groups. Keep an untouched copy when those distinctions may matter.

Numeric comparison needs review for mixed lines

Numeric mode is intended for number-like values. Lines containing units, labels, locale-specific separators, very large decimals, or partially numeric text may not follow the business order you expect.

The workspace has an input-size limit

Processing is capped at 1,000,000 input characters to avoid unbounded work during automatic updates. Use a streaming script or command-line pipeline for substantially larger lists.

Examples

Clean and sort a list

Trim values, remove duplicates, and sort numbered items naturally.

Frequently asked questions

Which duplicate is kept?

Duplicate removal keeps the first encountered line after optional trimming. Case-insensitive mode treats letter-case variants as the same key.

What does natural numeric sorting do?

It compares digit sequences numerically, so item2 sorts before item10 instead of using character-by-character lexical order.

Are original line endings preserved?

Output uses LF line endings. CRLF input is accepted and normalized during processing.

Related tools