Sort a CSV by column
Sorting in a spreadsheet is easy until the file is too large to open, or until you sort one column and the rest of the row stays put. This sorts whole rows by the column you name, detects automatically whether the values are numbers or text, and keeps rows with equal values in their original order.
Your file stays on this computer. There’s no upload button here, because there’s nowhere to send it. This tool runs inside the page you opened — like a calculator on a web page, it keeps working once it has loaded. How this works, and how to check it →
How to use it
- Choose your CSV file.
- Type the column heading to sort by, exactly as it appears in your file.
- Choose a direction, then click Sort.
Questions
Is my file uploaded anywhere?
No. The whole tool is inside this page, so the work happens on your computer. There is no server to send it to. If you'd rather check than take our word for it: use the tool once, on a sample file, with the settings you want. Then turn off your wi-fi and do exactly the same thing again in that tab, without reloading. It still works, because everything it needs is already here.
Why is 10 sorting before 9?
That shouldn't happen here — sorted as text, this page already reads 9 before 10. If the order still looks wrong, the values probably aren't plain numbers, like "$1,200" or "1,200" with a comma. Take out the symbols and separators, then set "Sort the values as" to Numbers.
Where do blank values end up?
At the bottom, in both directions. Blanks aren't meaningfully larger or smaller than anything, and having them sink is more useful than having them lead in one direction and trail in the other.
Do rows stay intact?
Yes. Whole rows move together, so a value never gets separated from the rest of its row.
How do I sort a CSV file in Excel?
Open it, select the data, then Data → Sort and pick the column. One trap: when you save, Excel writes the CSV back its own way. It drops leading zeros, reformats dates to your region and can change the delimiter. If the file goes on to another system afterwards, that's where it breaks. Sorting here leaves every value exactly as it arrived.
Can I rank rows by a column?
Yes — sort by that column and choose "Z to A, or largest to smallest", so the biggest value is at the top. If one cell holds a word instead of a number, the column sorts as text and that word comes out on top. Set "Sort the values as" to Numbers and it sinks to the bottom instead.