Crunchify.net

Sort Lines

Sort, dedupe and clean up lines of text with steps you chain and reorder. Your text never leaves this page.

Text
Result

10 lines in, 6 lines out

Steps
  1. 1. Trim whitespace

    Leaves 10 lines

  2. 2. Remove empty lines

    Leaves 8 lines

    Lines holding only spaces or tabs count as empty.

  3. 3. Remove duplicates

    Leaves 6 lines

    Keeps the first copy of each line. Spaces count, so trim first to catch “apple ” too.

  4. 4. Sort

    Leaves 6 lines

    Numbers inside a line count by value, so file2 comes before file10. Ignores case.

Add a step

Paste a list, then build the clean-up you need out of steps: sort it, remove the duplicates, trim stray spaces, number it, pull one column out of a table, find and replace, join it into one line, or turn every line into a URL slug. The steps run top to bottom, each on the output of the one above, and you can reorder them with the arrow buttons. The result updates as you type, and each step shows how many lines it left, so you can see which one removed what.

A worked example

The page opens on ten messy lines: banana with leading spaces, Apple and apple, file10.txt and file2.txt, a blank line, a line of spaces, and a second banana. Four steps clean it up. Trimming leaves ten lines but removes the stray spaces. Removing empty lines takes it to eight. Removing duplicates with ignore case on takes it to six, because apple repeats Apple and the two bananas are now identical. A natural sort then gives Apple, banana, cherry, Date, file2.txt, file10.txt.

Order matters. Trim before you remove duplicates, or banana and   banana count as different lines. Number after you sort, or the numbers are shuffled along with the lines.

Which sort to pick

  • A–Z is dictionary order and ignores case, so apple and Apple sit together. Lines that tie keep the order they came in. Accented letters sort beside their plain ones: éclair comes after cherry, not after Zebra.
  • Natural is A–Z, except that a run of digits counts as a number. A–Z puts file10.txt before file2.txt, because the character 1 comes before 2. Natural puts file2.txt first. Use it for file names, versions and chapter numbers.
  • Numeric orders by the number each line starts with. It reads a minus sign, decimals, an exponent and thousands commas, so 1,250 users is 1,250 and 1e3 is 1,000. Lines that do not start with a number, like n/a, go to the end in their original order. They stay at the end when you reverse the sort, too, so reversing only reverses the numbers.
  • Case-sensitive sorts by character code, the way sort does on the command line under the C locale. Every capital letter comes before every lowercase one, so Zebra comes before apple.

Every sort can be reversed with its switch, for Z to A or largest first.

Duplicates and case

Removing duplicates keeps the first copy of each line and drops the later ones, so the list keeps its order. By default it is exact: Apple and apple are different lines. Turn on ignore case and they count as the same, and the first one wins. Spaces always count, which is why a trim step usually goes first.

Find and replace

Find and replace works on plain text unless you ask otherwise: a dot is a dot and a dollar sign is a dollar sign. Switch on regular expression for JavaScript patterns. They run line by line, so ^ and $ mean the start and end of each line, and the replacement can use $1 for a captured group. Finding (\d+)-(\d+)-(\d+) and replacing it with $3/$2/$1 turns 2024-06-01 into 01/06/2024. A pattern that does not compile shows a message and the step is skipped, so the rest of the chain still runs.

Columns, joining and slugs

Extract column splits each line on a delimiter and keeps one field, counting from 1. Text copied from a spreadsheet is tab-separated, so pick the Tab preset. Follow it with Join lines and a comma to turn a column into a comma-separated list. In the separator and delimiter boxes, \t means a tab and \n a new line. Slugify lowercases each line, drops accents and turns everything else into hyphens, so Crème Brûlée! becomes creme-brulee and Straße 5 becomes strasse-5.

Sharing a set of steps

The address bar carries your steps and their settings, so Copy link to these steps gives you a link that opens the same clean-up for someone else, or for you next week. The link carries the steps, never the text. Lists are often private, so the person who opens it pastes their own. The text is not saved either: it stays in this tab and is gone when you close it. Nothing you paste is sent anywhere.

What it does not do

Column extraction splits on the delimiter and does not read CSV quoting, so a comma inside quotes still splits the field. For real CSV, the CSV to JSON converter parses it properly. For longer chains that mix line operations with decoding, hashing or date reformatting, CyberChef chains the same kind of steps from more than 500 operations, and its sort adds IP-address and length orders. It runs in your browser too, but its page loads Google Analytics.

How do I remove duplicate lines but ignore upper and lower case?

Add a Remove duplicates step and turn on Ignore case. The first copy of each line is kept, so if Apple comes before apple, Apple stays. Put a Trim whitespace step above it so lines that differ only by a trailing space also count as duplicates.

Why does 10 sort before 2?

An A–Z sort compares characters, and the character 1 comes before 2. Use Natural to compare numbers inside lines by value (file2 before file10), or Numeric to order whole lines by the number they start with.

Where do lines without a number go in a numeric sort?

To the end, in the order they were in. Reversing the sort keeps them at the end and reverses only the numbered lines. A line counts as numbered when it starts with a number, after any spaces: 12 apples is 12, but page 3 has no number.

Does the share link contain my text?

No. The link holds only the steps and their settings. Whoever opens it gets the same steps and pastes their own text.

How do I turn a spreadsheet column into a comma-separated list?

Paste the rows, add Extract column with the Tab preset and the column number, then Join lines with the Comma preset. Add Remove empty lines between them if some rows are blank.

Can I use regular expressions?

Yes. In a Find and replace step, turn on Regular expression. Patterns are JavaScript regular expressions applied to one line at a time, and the replacement can use $1, $2 or $<name> for captured groups. Without the switch, everything you type is matched literally.

Why did a blank line disappear from the end of my list?

One line break at the very end of the text ends the last line rather than starting a new, empty one, so it is not counted as a line. A blank line before it is kept, unless a Remove empty lines step removes it.

Updated October 18, 2026