What this tool does
Paste a list with one item per line and the result appears as you type. You can sort alphabetically, naturally (so file2 comes before file10) or by the number at the start of each line. You can also remove duplicate, repeated or empty lines, count how often each line occurs, sort by a column, number the result, reverse it or shuffle it. The tool works on plain lines of text. It is not a spreadsheet or a CSV parser.
The steps are always applied in this order: take the header line out (if you set one), trim spaces, remove empty lines, apply the duplicates option, sort, add counts, add line numbers, and put the header back on top. Lists of up to about 8 MiB are supported, and large lists are sorted in a background worker so the page stays responsive.
Alphabetical sorting and case
There are two ways to compare text, and they give different results for the same list. For the list banana, Apple, cherry, apple, Zebra:
| Setting | Result |
|---|---|
| Dictionary, ignore case | Apple, apple, banana, cherry, Zebra |
| Dictionary, case-sensitive | apple, Apple, banana, cherry, Zebra |
| Code order, case-sensitive | Apple, Zebra, apple, banana, cherry |
- Dictionary order follows language rules (the browser’s English collation). Accented letters sit next to their base letters, and with case-sensitivity on, a lowercase letter comes just before the same capital letter.
- Code order compares Unicode code points. All capitals come before all lowercase letters, and accented letters come after
z. This is the order ofLC_ALL=C sort, and it is predictable across machines. - Ignore case treats
Appleandappleas equal. Lines that compare equal keep their original order, because the sort is stable. - The collation is fixed to English so results do not change with your device settings. Other languages may expect a different order for their own letters.
Numeric, natural and lexicographic sorting
Text sorting compares character by character, so 10 comes before 9, because 1 is smaller than 9. Numbers need a numeric comparison.
| Order | Input 10, 9, 100, 2, 1 | Input file10, file2, file1, file20, file3 |
|---|---|---|
| Text (code order) | 1, 10, 100, 2, 9 | file1, file10, file2, file20, file3 |
| Numeric | 1, 2, 9, 10, 100 | not meaningful: no number at the start |
| Natural | 1, 2, 9, 10, 100 | file1, file2, file3, file10, file20 |
- Numeric uses the number at the very start of each line, optionally with a sign, decimals or an exponent (
-5,3.25,1e3). Everything after the number is ignored for the comparison. Thousands separators are not understood, so1,000counts as 1. Lines with no leading number go last, in alphabetical order. Whole numbers are compared exactly, even beyond 15 digits, so long IDs are not rounded. - Natural compares each run of digits as a number anywhere in the line and the rest as text. It suits file names and version strings:
1.2.0, 1.2.10, 1.9.1, 1.10.0. It does not understand semantic-version pre-release tags such as-beta. - Length orders by the number of characters, with an emoji counted as one character.
- When two lines compare as equal, they keep the order they had in the input (a stable sort). This also applies to the descending orders, which reverse the comparison, not the list.
Removing duplicates
The duplicates option works on whole lines. For the list a, b, a, c, b, a:
| Option | Result |
|---|---|
| Keep duplicates | a, b, a, c, b, a |
| Remove duplicates (keep first) | a, b, c |
| Remove duplicates and show counts | 3 a, 2 b, 1 c (most frequent first) |
| Keep only repeated lines | a, b |
| Keep only lines that appear once | c |
- The first occurrence of each line is kept, and later copies are dropped before sorting, so the surviving lines come from the earliest position in your input.
- With Ignore case on,
Appleandappleare duplicates. The tool tells you when that merged lines that differed only in capitals. - Counts are shown like
uniq -c: the count, a space, then the line. Choose Most frequent first to rank them. - The duplicates check always looks at the whole line, even when you sort by a column.
Whitespace, empty lines and line endings
- Trailing spaces make lines different.
apiandapiare not duplicates unless you turn on Trim spaces, and you cannot see the difference. Trimming removes ordinary and Unicode whitespace at both ends of each line. - Empty lines are kept by default and sort to the top. Remove empty lines also removes lines that contain only spaces.
- Line endings. Windows (CRLF), Unix (LF) and old Mac (CR) endings are all recognised. The output uses the style of your input, and the tool says so when the input mixed several. A final line break is kept and does not count as an empty line.
- Header rows. If the first line is a title or header, tick First line is a header so it stays on top and is not sorted with the data.
Sorting by column
Enter a column number to sort by the text in that position, split on a comma, tab, semicolon, pipe, colon, any run of whitespace or text of your own. The whole line is still output. For example, with the header option on, column 3 and a numeric descending order, the rows of id,name,score are ranked by score.
This is a plain split, not a CSV parser. A delimiter inside a quoted field ("Smith, Jo",42) is still treated as a delimiter, and quotes are not removed. A line with fewer columns counts as having an empty value there. For real CSV with quoting, use the CSV Viewer, which can sort a table by column, or the JSON ⇄ CSV Converter.
Common developer uses
| Task | Settings | Notes |
|---|---|---|
| Package and dependency lists | A to Z, ignore case, remove duplicates | A tidy, diff-friendly list. Do not sort files where order has meaning, such as lines that include -r or index options, or build steps. |
| Imports and require lines | A to Z, code order | Plain line sorting only. Language tools such as isort or ESLint follow extra rules, so use them for the final order in a codebase. |
| Domains and hostnames | A to Z, ignore case, trim, remove duplicates | Hostnames are case-insensitive, so duplicates differing in case are the same name. |
| IDs and numbers | Numeric, low to high | Exact for whole numbers of any length. Use text order if the IDs have leading zeros you need to preserve in order. |
| Log lines | A to Z, code order | Lines that start with an ISO 8601 timestamp sort chronologically as plain text, for example 2026-10-09T07:59:12Z. Remove duplicates and counts show repeated messages. |
| Config values and allowlists | A to Z, trim, remove duplicates | Catch repeated entries in environment variables, feature flags or IP and domain allowlists. |
| File names and versions | Natural | app-v2.js before app-v10.js, and 1.9.1 before 1.10.0. |
| CSV-like lines | Sort by column, header on | Fine for simple data without quoted delimiters. |
Command-line equivalents
These shell commands do close to the same work. They are similar, not identical in every edge case: locale, how blanks are treated and where non-numeric lines are placed can differ.
| Setting here | Shell command |
|---|---|
| A to Z, code order | LC_ALL=C sort |
| Ignore case | sort -f |
| Remove duplicates (keep first) | sort -u sorts too; to keep the original order use awk '!seen[$0]++' |
| Numeric | sort -n |
| Natural / version order | sort -V |
| Counts, most frequent first | sort | uniq -c | sort -rn |
| Reverse order | tac |
| Shuffle | shuf |
During development the code-order, ignore-case, numeric, natural and duplicate options were compared with GNU sort and a Python reference on thousands of random lists.
Common mistakes
- Sorting numbers as text and getting
1, 10, 2. Choose Numeric or Natural. - Expecting
Appleandappleto be duplicates, or not expecting it. Check Ignore case. - Missing duplicates that differ only by a trailing space or a Windows line ending. Turn on Trim spaces.
- Sorting a file together with its header row. Use the header option.
- Assuming every tool orders accents and capitals the same way. Dictionary order, code order and your database’s collation can all differ. If a result must match another system, use the same rule there.
- Sorting lines whose order matters, such as shell scripts, SQL statements or config files with overrides.
Before and after sorting
To see exactly what changed, paste the original and the result into the Text Diff Checker. To count lines, words or characters, use the Word & Character Counter. If your lines have inconsistent capitalisation, normalise them first with the Case Converter. Before putting list items into a string in code, escape them with the String Escape & Unescape tool. To pick lines out of a list by pattern, try the Regex Tester.
Frequently asked questions
How do I sort lines alphabetically?
Paste the list, leave the order on A to Z and copy the result. Use Z to A for the reverse.
How do I remove duplicate lines?
Choose Remove duplicates (keep first) in the Duplicates menu. To see which lines are repeated, choose Remove duplicates and show counts or Keep only repeated lines.
Why does 10 come before 9?
Text order compares characters. Switch to Numeric or Natural order.
Is the sort stable?
Yes. Lines that compare as equal keep their input order, in both ascending and descending sorts.
How large a list can I sort?
Up to about 8 MiB of text. The tool reports it if you go over, and nothing is cut off silently.
Is the shuffle truly random?
It uses the browser’s cryptographic random number generator. Do not use it for anything where a flaw would matter beyond ordinary shuffling.
Does it upload my list?
No. Everything runs in your browser.
Privacy and local processing
This tool runs entirely in your browser. Your lines are processed by JavaScript on this page, or by a worker started from this page, and are not sent to a server. Nothing is stored.