Sort Lines

Sort text lines alphabetically with options for descending order, unique lines, and case sensitivity. This sort lines tool is useful for keywords, names, and copied lists.

Whether you call it sort lines or sort text lines, this free tool handles it instantly in your browser.

19 chars3 words
19 characters, 3 words

Options

Live preview
apple banana banana

Example usage

Example input

banana apple banana

Example output

apple banana

Batch Processing

Enter multiple inputs, one per line. Each line will be processed separately.

Why this tool?

Everything runs right in your browser — no uploads, no sign-up, no waiting. Your text never leaves your device.

Quick tips

  • Outputs update live as you type.
  • Use the sticky copy button to grab results quickly.
  • Bookmark this page for fast access.

More like this

Discover related tools and step-by-step guides for this kind of task.

See all related tools

How it works

  • Paste line-based text into the input field.
  • The tool sorts each non-empty line in ascending or descending order.
  • Optional unique and case-sensitive modes help you control how lines are compared.

Use cases

Sort keyword lists before exporting.
Organize copied names, tags, or notes quickly.
Deduplicate simple line lists with unique mode.
Prepare clean, ordered text for spreadsheets and docs.

Sorting is more opinionated than it looks

A computer sorting "by default" uses character codes, where every uppercase letter sorts before every lowercase one — so Zebra lands before apple. That is almost never what a human wants, which is why sorting tools have to make a deliberate choice about case. Numbers are the other classic surprise: sorted as text, 10 comes before 2, because the comparison happens character by character and "1" is less than "2".

The workaround for numbers is zero-padding (01, 02, 10), which makes text order match numeric order. It is the same reason well-named files use 2026-07-04 rather than 4-7-2026: the ISO date format is designed so that alphabetical order and chronological order are the same thing.

Sort, dedupe, or alphabetize?

This tool sorts lines with control over direction, uniqueness, and case — the general-purpose option for lists and code. If your goal is specifically dictionary-style A–Z or Z–A ordering of words and names, our Alphabetical Order tool is tuned for that and explains reverse alphabetical order along the way. If you only want repeats gone while keeping the original order, Remove Duplicate Lines does that without touching sequence.

A note on the unique option: sorting groups identical lines together, which makes duplicates trivial to spot and remove in one pass. That is why "sort and dedupe" is the traditional pairing in command-line work — the sort is what makes the deduplication cheap.

Cleanup

Explore all text cleanup tools

Browse every tool for this kind of task, along with helpful guides that show you how to get the most out of them.

Browse Cleanup

Related tools

Conversion History

Loading...

FAQ

Can I sort lines in reverse order?

Yes. Turn on the descending option to reverse the sort order.

Does unique mode remove duplicate lines?

Yes. It keeps only the first matching version of each line before sorting.

Are blank lines included?

No. Empty lines are skipped so the sorted output stays clean.