CSV Sorter
When you only need the CSV sorted, opening Excel or LibreOffice just to click on a column header feels like a lot of ceremony. Paste the CSV, pick a column by position, choose ascending or descending, and the sorter emits the rows in natural order, item2 sits before item10 the way a human expects, not the way raw ASCII would put it.
How to sort your CSV
-
1
Paste the CSV
Header row optional. Use the checkbox to tell the sorter whether to freeze row 1 on top.
-
2
Pick a column
1-based index, e.g. `2` to sort by the second column.
-
3
Choose direction
Ascending by default. Toggle descending to flip the order.
-
4
Copy the sorted CSV
The output preserves the header (if present) and writes every data row in sorted order.
Natural sort versus lexicographic sort
The sorter uses PHP’s strnatcasecmp, which compares strings the way a person reads them: digits are treated as numbers and case is ignored.
Ordering comparison
| Input values | Lexicographic (default) | Natural (this tool) |
|---|---|---|
item1, item2, item10 |
item1, item10, item2 |
item1, item2, item10 |
Alice, bob, Carol |
Alice, Carol, bob |
Alice, bob, Carol |
2024-01-01, 2024-2-1 |
2024-01-01, 2024-2-1 |
2024-01-01, 2024-2-1 |
file10.txt, file2.txt |
file10.txt, file2.txt |
file2.txt, file10.txt |
Dates and numbers
- ISO-8601 dates sort correctly as text (
2024-01-15before2024-02-01). Use ISO dates whenever you can. - Ambiguous formats like
1/15/2024do not sort correctly. Convert them to ISO first with a date formatter. - Numbers mixed with text sort naturally, so
row2beatsrow10as a human would expect, but pure numeric sorting will be exact only when the cell contains nothing else. If you need strict numeric order, strip suffixes first with a text tool and sort the clean column.
Tips
- Sort, then dedupe. When you run the Deduplicator after sorting, the “first row wins” rule becomes deterministic, you know which copy will be kept.
- Stable sort is preserved: rows tied on the sort key keep their original relative order.
- Single-column only. For multi-column sorts (sort by country, then by revenue), run the sorter twice: first on the secondary key, then on the primary. Natural sort is stable, so the secondary order survives.
Frequently Asked Questions
It does not, in this tool. The sorter uses natural-order comparison, so 2 precedes 10. If you are getting ASCII order, double-check that you are reading this tool’s output and not your spreadsheet’s raw sort.
Sort twice: first by the secondary key, then by the primary. The comparison is stable, so the secondary ordering survives inside groups of equal primary values.
No. Uppercase and lowercase letters compare equal, so alice and Alice are treated as the same string for ordering purposes.
No. Parsing and sorting happen entirely in your browser; the CSV stays on your device.
Related Tools
Word to Markdown Converter
Convert a Word DOCX file to clean Markdown in your browser. Keep headings, lists, links and simple tables, then copy or download the editable .md file.
Subtitle Converter
Convert SRT subtitles to WebVTT or VTT captions to SRT locally. Validate cue timings, preserve multiline text, then copy or download the result.
Excel Sheet Merger
Combine XLSX, XLS, XLSM, XLSB or ODS files locally. Keep source sheets separate or append rows with matching headers, then download an XLSX.
M4A to MP3 Converter
Convert M4A audio to MP3 for wider playback support. Upload an .m4a file and download a compatible .mp3 copy.
CSV to Excel
Convert CSV data to a single-sheet XLSX workbook in your browser. Review delimiters, preserve identifiers, infer safe numbers, and keep file contents local.
Archive Extractor
Inspect ZIP, JAR, XPI, DOCX, XLSX, PPTX and ODT containers locally in your browser, then download individual files without uploading the archive.
Tool available in other languages
- CSV-sorterare [SV]
- Pemilah Data dalam Format CSV [ID]
- เครื่องจัดเรียงข้อมูลในรูปแบบ CSV [TH]
- CSVソーター [JA]
- Trình sắp xếp dữ liệu CSV [VI]
- Ordenador CSV [ES]
- CSV Sıralayıcı [TR]
- CSV-Sorter [DE]
- Trier CSV [FR]
- Classificador CSV [PT]
- CSV排序器 [ZH]
- فارز CSV [AR]
- CSV 정렬기 [KO]
- CSV-sorter [NL]
- Sorter danych w formacie CSV [PL]
- Сортировщик CSV [RU]
- Ordinatore CSV [IT]