Sort a CSV file by a column
Sort a CSV by any column, as text or as numbers, blanks last. Every value stays exactly as written and the file never leaves your device.
How this works
- Add your file. Drop a CSV onto the page, or pick one.
- Choose the column and the order. Pick the column to sort by, smallest or largest first, and whether to treat it as numbers.
- Sort the rows. Check the preview, then download the sorted file.
What it cannot do
- One column at a time. A sort by several columns is a one-line ORDER BY on the SQL page, which reads the same file.
- The download is written fresh: values are carried through as text exactly as they were, but quoting and line endings follow the standard form rather than the original bytes.
- Rows with the same value keep no particular order between themselves.
Questions
- Why does Excel put 10 before 9 when I sort?
- Because it is sorting the column as text, where "1" comes before "9" and so "10" comes before "9". Tick "Sort as numbers" here and 9 comes before 10; the switch is set for you when the column looks numeric.
- Will sorting change any of my values?
- No. When you sort a CSV file by a column here, every cell is carried through as the exact text in your file — leading zeros, long numbers and dates included. To sort a CSV file by a column is to change the arrangement, never a value: the download is written fresh with standard quoting and nothing in it is retyped.
- Where do blank cells go?
- Last, whichever direction you choose. A column sorted largest-first starts with the largest value, not with a run of empty cells.
- What happens to a word in a column of numbers?
- With "Sort as numbers" on, a value that is not a number is treated as blank for ordering and goes to the end. It is not changed or removed — it is still in the file, in the same cell.
- Can I sort by more than one column?
- Not on this page — it does one column well. For a sort by two or three columns, the SQL page runs an ORDER BY over the same file.
- How big a file can it sort?
- Well past the point where Excel stops. Files larger than memory are read from disk as needed, and the sorted result is written out as a stream rather than held in the page.
- Is my file uploaded anywhere?
- No. When you sort a CSV file by a column here, the work happens inside this page and the browser is told to block outbound connections, so there is no upload to intercept. Watch the Network tab of your developer tools while you sort a CSV file by a column: the only requests are for this site’s own code, and none carries your file.
Your file is processed in this page and never uploaded — the privacy page shows how to confirm that yourself.