File tools · CSV
Sort a CSV by column, as numbers, dates or text.
A text sort puts 10 before 2. Choose the type of each column and the order is right: numbers by value, dates by calendar, names alphabetically, with up to three sort keys.
Pick the column and how to read it. The sort is stable, so rows with equal values keep their original order, and blank or unreadable values always go last.
Why a text sort gets numbers wrong
Sorting as text compares character by character, so 10 comes before 2 because 1 is less than 2, and $1,200 lands in the middle of the $1 values. Choosing Number reads each cell as a value first. It understands a leading minus, a currency symbol (dollar, euro, pound, yen) before or after the number, thousands separators, a percent sign, and accounting-style negatives in parentheses: (4) means minus 4. With the decimal mark set to comma, 1.234,50 reads as 1234.5.
Date reads ISO dates (2026-10-21), slash and dot dates, and day-month-name dates (21-Oct-2025), each with an optional time. Year-first dates are unambiguous; for 03/04/2026 you choose whether the month or the day comes first. Impossible dates such as 2026-02-30 are rejected, not rolled over to March. Text, numbers inside in order sorts file2 before file10 using the browser’s collation rules.
Your file stays on your device
The sort runs in JavaScript on the parsed rows in this tab. The frame is sandboxed with no network access, so the data in your file never leaves the machine in front of you.
Worked example
A ledger has an amount column holding $1,200.50, -3, a blank, abc, (4), 1200.50 and 10. Sorted ascending as numbers the order is (4), -3, 10, $1,200.50, 1200.50, then the blank and abc at the end. The two 1,200.50 rows keep their original relative order because the sort is stable. The page warns that one value could not be read as a number, which is how you spot the stray abc in a column you thought was clean.
Multiple keys and stability
With several keys, rows are ordered by the first, ties are broken by the second and then the third, and any remaining ties keep the order they had in the file. Stability is guaranteed by the language: JavaScript’s array sort has been required to be stable since ECMAScript 2019. A common use is to sort by a category column and then by amount descending to see the largest items in each category.
Common mistakes
- Dates in two formats in one column. Mixed formats sort wrongly or are reported as unreadable. Convert them to one format first.
- Sorting identifiers as numbers. Codes such as
007and070should be sorted as Text; as Number they are read as 7 and 70. Either way the values themselves are never rewritten. - Wrong decimal mark. European exports use
1.234,50. Read as the point style it fails to parse and lands at the end. - Header row in the data. If the first row is data, untick the header box or it will be sorted with the rest.
Locale and collation
Text order is not the same everywhere. The tool uses the browser’s collation rules (Intl.Collator), which ignore case by default and place accented letters next to their base letter, so École sorts with the Es rather than after Z as a raw character-code sort would put it. Tick the case-sensitive box to get code-point-style ordering, so capitals sort before lowercase letters. The result can differ slightly between a computer set to English and one set to Swedish or German, because those languages order some letters differently. If you need an order that is identical on every machine, sort numbers and ISO dates, which do not depend on locale.
What this tool does not do
It does not sort by more than three columns, sort within groups of an unsorted file independently, or understand month names in languages other than English. Text order follows your browser’s locale rules, so accented letters sort the way your system sorts them. It does not filter rows; for that, or for removing repeats, see the duplicate-row remover.
Frequently asked questions
Why does my CSV sort 10 before 2?
Because the sort is treating the column as text. Choose Number for that column, and values are compared by size instead of character by character.
How do I sort by date?
Choose Date for the column. ISO dates, slash and dot dates and 21-Oct-2025 style dates are read; for 03/04/2026 pick whether the month or the day comes first.
What happens to blank or unreadable cells?
They go last in both ascending and descending order, and the page tells you how many values could not be read as the chosen type.
Is the sort stable?
Yes. Rows with equal keys keep the order they had in the file, so you can sort in several passes or use multiple keys.
Can I sort by two or three columns?
Yes. Set a second and third key; each has its own type and direction.
Does it handle currency and negative numbers?
Yes: currency symbols, thousands separators, a percent sign, a leading minus and parentheses for negatives are all read. Letters inside a number make it unreadable.
Is my file uploaded?
No. It is parsed, sorted and written in your browser tab, in a frame that has no network access.
Sources
- RFC 4180: Common Format and MIME Type for CSV Files (Y. Shafranovich, October 2005) — the record, quoting and line-break rules the parser follows
- MDN: Array.prototype.sort — the sort is stable since ECMAScript 2019
- MDN: Intl.Collator — locale-aware text comparison, including numeric collation
Check the unreadable-value warning
If the page reports values it could not read as numbers or dates, fix them at the source or choose a different type before relying on the order.