Sort CSV data by multiple columns with custom ordering
Sort a CSV file by one or more columns, ascending or descending, with proper numeric and date-aware ordering. Upload, pick your sort keys, and download the result.
Initializing in your browser…
You need the orders file sorted by date, then by total descending, for a top-spenders review.
Sort keys
1) date ASC 2) total DESC
Output
Stable multi-key sort applied; ties broken by the second key
Multi-column, mixed-direction sorting with stable ordering means equal dates keep their relative order while totals rank within each date, the behaviour a naive single-column sort cannot give you. Numeric columns sort numerically, not as text, so 9 does not come after 100.
Sort a CSV file by one or more columns, ascending or descending, with proper numeric and date-aware ordering. Upload, pick your sort keys, and download the result.
CSV Sorter is a multi-key sorter: you stack any number of sort rules, and the engine walks them in priority order so the first rule is the primary key, the second breaks ties, the third breaks remaining ties, and so on. Each rule pairs a column with a direction (Ascending A->Z, 0->9 or Descending Z->A, 9->0). You reorder priority with the up/down arrows on each rule (top rule wins), and when more than one rule is active the preview table shows a small numbered badge next to each sorted column header so you can see exactly which key is being applied first. There is also a fast path: clicking a column header in the preview cycles that column through ascending, then descending, then unsorted, but note this header-click replaces the whole rule set with a single rule on that column rather than adding to your existing multi-column stack. Files are parsed with PapaParse (skipEmptyLines), which surfaces fatal quote/delimiter errors as a toast and downgrades field-count mismatches to a warning so a slightly ragged file still loads.
Sorting behavior is driven by a per-rule data type that you expose with the Advanced options toggle: Auto Detect, Text, Number, or Date. In Number and Auto modes the tool runs parseFloat after stripping commas and dollar signs only (the regex is /[,$]/g), so values like $1,299 compare as 1299 numerically; other currency symbols, percent signs, or thousands separators that are not commas are not removed. When Auto mode cannot parse both cells as numbers it falls back to localeCompare with { numeric: true, sensitivity: 'base' }, which gives natural ordering so 2 sorts before 10 and file2 before file10 rather than lexicographic order. Plain Text mode uses localeCompare with sensitivity 'base' but without the numeric option, so it is case- and accent-insensitive but does NOT do natural numeric ordering. Empty cells are treated as empty strings, so missing values group together rather than throwing.
Date sorting is the one area to use with care, and this is worth stating plainly: the Date mode parses each cell with the JavaScript Date constructor (new Date(value)) and compares timestamps. That is reliable for ISO 8601 dates like 2026-06-23, but the Date constructor interprets slash-formatted dates as US month/day order, so a DD/MM/YYYY column will sort incorrectly, and many locale-specific formats parse as NaN; in those NaN cases the tool silently falls back to a plain string comparison of the raw text. For mixed or non-ISO date columns, normalize to YYYY-MM-DD first (for example with the CSV transformer) and then sort that column as Text, which sorts zero-padded ISO dates correctly by string. Everything runs in the browser with a live preview of the first 10 rows, and the result downloads via Papa.unparse as {filename}_sorted.csv; a built-in 9-row products sample (Product, Category, Price, Stock, Rating) lets you try multi-key sorts like Category ascending then Price descending without supplying your own file.
Sort sales data by revenue or scores by ranking for reporting.
Sort log or event data by date column for time-series analysis.
Using the built-in products sample, add rule 1 = Category (Text, Ascending) and rule 2 = Price (Number, Descending). The engine groups rows by category alphabetically, then within each category orders price high-to-low, so the cheapest item in each category appears last.
Sort a column of values like file2, file10, file1 in Auto mode. Because Auto falls back to localeCompare with numeric: true, the result is file1, file2, file10 instead of the lexicographic file1, file10, file2. Note that Text mode does NOT apply numeric ordering, so use Auto (or Number, if the cells are pure numbers) for natural sort.
Yes. The sorter detects numeric columns and sorts them by value, not alphabetically, so 2, 10, 100 instead of 10, 100, 2.
Rows and columns are parsed and transformed in memory in your browser. No record ever reaches a server.