Skip to content

CSV Sorter

Order the rows of a CSV by one column, comparing values as text, natural text, numbers or dates.

Processed locally in your browser

Options

A header name or a 1-based number.

0 chars · 0 lines
The result will appear here.

What is CSV Sorter?

Sorting a CSV as plain text puts 100 before 9 and mixes up dates. This tool lets you choose how values are compared: alphabetically, in natural order (file2 before file10), as numbers (currency symbols and thousands separators are understood) or as dates (ISO 2024-03-01 and 15/03/2024 formats).

The sort is stable: rows with equal keys keep their original relative order, so you can sort by several columns by running the tool once per column, from the least to the most important. Blank or unparseable values are always placed last, in either direction, and reported as a warning.

How does it work?

  1. Paste the CSV or open a file.
  2. Type the column to sort by (header name or number) and choose ascending or descending.
  3. Select how to compare: text, natural, number or date; tick case-sensitive if needed for text.
  4. Check the preview and copy or download the sorted CSV. The header row stays on top.

Common use cases

  • Ranking a sales export by revenue from highest to lowest.
  • Ordering event logs chronologically before analysis.
  • Sorting a contact list alphabetically by last name.
  • Putting version-like or numbered names (item2, item10) in a human order.

Examples

Try this input in the tool above:

Input
id,name,email,city,age
1,Alice Martin,alice@example.com,Paris,34
2,Bob Durand,bob@example.com,"Lyon, France",28
3,Chloé Petit,chloe@example.com,Nice,41
4,David Roux,david@example.com,Paris,19
Output
id,name,email,city,age
3,Chloé Petit,chloe@example.com,Nice,41
1,Alice Martin,alice@example.com,Paris,34
2,Bob Durand,bob@example.com,"Lyon, France",28
4,David Roux,david@example.com,Paris,19

Privacy

CSV Sorter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Slash-separated dates are read day first (dd/mm/yyyy). Sorting by several keys requires running the tool repeatedly, starting with the least significant column.

Frequently asked questions

Why does numeric sorting matter?

As text, "100" sorts before "9" because the first character is compared. In number mode 9 comes first, and formats like 1,234.50 or $12 are understood.

Where do empty cells go?

Always at the end, whether you sort ascending or descending, so blanks never hide the data you are interested in.

How do I sort by two columns?

Sort by the secondary column first and then by the main column. Because the sort is stable, ties in the main column keep the secondary order.

More tools in JSON & Data →