Paste a list with one entry on each line, press a button and read the result on the right. You can sort lines alphabetically, sort them by length, reverse the order, delete duplicate lines and strip empty lines and stray spaces.
Sort lines alphabetically in four steps
- Paste your list into Input list. The box starts with a short fruit list that you can overwrite.
- Press one of the six buttons: Sort A → Z, Sort Z → A, Sort by length, Remove duplicate lines, Trim empty lines & spaces or Reverse order.
- Check Cleaned result. The counter under it shows the number of lines.
- Press Copy, or .txt to save
cleaned-list.txt.
Every button reads the input box
No button works on the result. To sort and deduplicate, sort first, copy the result back into the input, then press Remove duplicate lines. The output box is read-only. While you type, it simply mirrors the input.
Why "apple" and "Apple" stay in input order
The alphabetical sort ignores case and accents and follows the rules of the page language. Two lines that differ only in case count as equal, so they keep their input order. Digits are read as numbers, which puts "file2" before "file10". A decimal such as 1.5 is not one number. Its parts are compared one by one.
Duplicate removal is stricter. It is case-sensitive and does not trim, so "Apple" and "Apple " with a trailing space are two entries. Run Trim empty lines & spaces first if you suspect hidden spaces.
- The three sort buttons drop blank lines.
- Reverse keeps every line, blank ones too, and flips their order.
- Remove duplicate lines keeps only the first blank line.
- Sort by length puts the shortest line first. For longest first, sort by length, copy the result back and press Reverse.
Merged mailing lists and an old hosts file
Join two mailing lists and the overlap disappears. Sort a keyword list before you give it to a colleague. Clean a .gitignore that grew for two years in one minute. Sorting by length finds odd entries fast: the shortest lines in a list of product names are often typos.
The list never leaves the page. Sorting and cleaning run in JavaScript, and a button press sends no request. The Network tab of the developer tools shows this. Copy writes to your clipboard and .txt downloads a file to your device, both only when you press the button.