Sort Lines
Sort any list alphabetically, naturally (file2 before file10), by length, by number or at random — and remove duplicates and empty lines in the same step.
Sorting options: language, case, accents, columns
Related Tools
How to Use
- Paste your list — Paste or type one item per line: names, keywords, file names, prices, CSV rows or anything else.
- Choose the order — Pick A → Z, Natural, Length, Numeric value, Shuffle, Reverse order or Keep order, and set the direction. Open the sorting options to choose a language, case and accent handling, leading articles or a column to sort by.
- Clean up at the same time — Tick Remove duplicates, Remove empty lines or Trim spaces if you need them. The live panel shows how many lines, duplicates and empty lines there are before you apply anything.
- Sort, then copy or undo — Press Sort Lines (or Ctrl+Enter in the text box). The sorted list replaces your text; copy or download it, or press Undo to get the previous version back.
About the Sort Lines tool
WritePadPro’s Sort Lines tool puts any list in order: names, keywords, file names, prices, CSV rows, bibliography entries or to-do items. It goes beyond a plain A → Z button with natural number ordering, language-aware alphabetising, sorting by length, value or column, an unbiased shuffle and built-in clean-up, all with undo.
Sort orders
| Order | What it does | Example result |
|---|---|---|
| A → Z | Alphabetical, letter by letter | file1, file10, file2 |
| Natural | Digit runs compared as whole numbers | file1, file2, file10 |
| Length | Shortest first (ties alphabetical) | fig, kiwi, banana |
| Numeric value | By the first number in each line | -3, 2.5, 9, 10, 1,000 |
| Shuffle | Random order, every order equally likely | (different each time) |
| Reverse order | Last line first, no sorting | c, b, a → a, b, c |
| Keep order | No sorting: only the clean-up options | (original order) |
Every order except Shuffle, Reverse and Keep order can run in descending direction (Z → A, longest first, largest first). Length counts characters as you see them, so an emoji or an accented letter counts as one.
Natural sorting
Plain alphabetical sorting compares one character at a time. Because “1” comes before “2”, chapter10 lands before chapter2, and IMG_100.jpg before IMG_20.jpg. Natural sorting reads each run of digits as a number, which is what people expect for file names, chapters, invoice numbers and versions: v1.2, v1.9, v1.10. Because each digit run is a whole number, 1.5 and 1.10 are treated like versions (5 < 10); use Numeric value when your lines contain real decimal numbers.
Language-aware alphabetical order
Alphabetical order is not the same in every language. The tool uses the collation rules built into your browser (the Unicode Collation Algorithm with CLDR data), and you can pick the language whose rules you need:
- German: Äpfel sorts with Apfel, before Zebra.
- Swedish and Finnish: Å, Ä and Ö are separate letters after Z.
- Danish and Norwegian: Æ, Ø and Å come last, in that order.
- Spanish: Ñ is its own letter after N (nube, ñu, oso).
- Czech: CH is a letter that follows H.
- Polish: Ł follows L; Turkish: dotless ı comes before i.
Character code order skips language rules and compares Unicode code points: spaces and many punctuation marks first, then digits, then capital letters, then lowercase letters, with a few symbols in between. Developers use it when output must match a program’s default string sort.
Case, accents and articles
By default, case is ignored and accents count only when the letters are otherwise identical, so “resume” and “résumé” sort side by side. Tick Ignore accents to treat é as e entirely, or Case-sensitive to make capitals count. Lines that compare as equal are ordered by a fixed tie-breaker (capitals first, then original position), so the same list always gives the same result. Ignore leading “The / A / An” sorts titles the way libraries do: “The Hobbit” files under H.
Order of operations
- Line endings are normalised; a final line break is kept at the end.
- Trim spaces removes spaces and tabs at the start and end of each line.
- Remove empty lines drops blank and whitespace-only lines.
- Remove duplicates keeps the first occurrence of each line.
- The lines are sorted, shuffled or reversed.
Leading and trailing spaces never affect the order, even when Trim spaces is off, so an indented line does not jump to the top.
Sorting by column
For tabular data, set Sort by column and the separator. A product list such as Mouse,49 sorted by column 2 in Numeric value order is ordered by price; a list of full names sorted by column 2 with the “spaces” separator is ordered by surname. Lines without that column go to the end, whatever the direction.
Privacy
Sorting happens entirely in your browser with JavaScript. Your list is not uploaded or stored, which makes the tool safe for customer lists, email addresses and other confidential data.
Frequently Asked Questions
Why does "file10" come before "file2" in A → Z order?
Alphabetical sorting compares text character by character, and the character "1" comes before "2", so file10 sorts first. Choose Natural instead: it compares runs of digits as whole numbers, so file2 comes before file10, and version numbers such as v1.9 and v1.10 come out in the right order.
Does it sort accented and non-English letters correctly?
Yes. Sorting uses your browser’s language-aware collation (Intl.Collator), so é sorts next to e rather than after z. Different languages order letters differently, and you can choose one under Language: in German Ä sorts with A, in Swedish Å, Ä and Ö come after Z, in Spanish Ñ follows N, in Czech CH comes after H, and in Danish Æ, Ø and Å are the last letters. "Character code order" ignores language rules and sorts by Unicode code point, the classic ASCII order.
How are uppercase and lowercase letters handled?
By default the comparison ignores case, so apple, Apple and APPLE sort together; when two lines differ only in case, the capitalised one comes first so the result is always the same. Tick Case-sensitive to make case count. For strict ASCII order, where every capitalised line comes before every lowercase line, choose "Character code order" as the language and tick Case-sensitive.
Can I sort by a column, such as a last name or a price?
Yes. Set "Sort by column" to the column number and choose the separator: comma, tab, semicolon, pipe or spaces. "John Smith" sorted by column 2 with spaces uses Smith. Lines that do not have that column go to the end. Quoted CSV fields that contain the separator are not parsed as one field.
How random is the shuffle?
The shuffle uses the Fisher–Yates algorithm with random numbers from your browser’s cryptographic generator (crypto.getRandomValues) and rejection sampling, so every possible order is equally likely. Press the button again for a new shuffle.
Which line is kept when duplicates are removed?
The first occurrence is kept and later copies are removed before sorting. Spaces at the start and end of a line are ignored when comparing. Case is ignored unless you tick Case-sensitive, and accents are ignored only when you tick Ignore accents, so the duplicate check follows the same options as the sort.
What does Numeric value do with text?
It sorts each line by the first number it contains, so "Item 9" comes before "Item 10" and "$5.50 cable" before "$49 mouse". Negative numbers, decimals with a point, thousands separators such as 1,299.99, exponents and percentages are understood. Lines without a number go to the end. Numbers written with a decimal comma (1.299,99) are not read correctly.
How many lines can it sort?
Everything runs in your browser, so the limit is your device’s memory. On a typical computer 100,000 lines sort in about a second or less. Your list is never uploaded.