Built on advanced on-device AI and hardware acceleration to deliver professional-grade performance with uncompromising privacy.On-device AI — professional-grade, fully private.
Sort CSV by Column
Sort CSV by column — numbers, dates and text, free, nothing uploaded.
- Runs on your device
- Numbers, dates and text — read properly
- Free to 25 MB · 50 files with Pro
Drop a CSV here
.csv, .tsv, .psv, .tab or .txt · up to 25.0 MB
The delimiter and encoding are detected from the file.
- Sort by
Up to 3 keys. The first decides; the rest break ties.
How values are compared once their type is known.
Blank options keep whatever the source file used.
One file at a time on Free.
Free sorts one file up to 25.0 MB.
Nothing loaded yet.
How to sort a CSV
- 1
Add your CSV
Drop a .csv, .tsv, .psv, .tab or .txt file, or paste the rows straight in. The delimiter, the text encoding and whether row one is a header are all detected and shown.
- 2
Choose the columns to sort by
Pick a column, leave the type on Auto or set it to Number, Text, Date or Length, and choose a direction. Add more keys to break ties, and reorder them to change which one wins.
- 3
Sort
The rows reorder on your device. The header stays on top, blank cells go where you asked, and the preview shows the result immediately.
- 4
Download or copy
Export as CSV or TSV with the line endings and encoding you need, copy the whole file to the clipboard, or take a batch as one ZIP with Pro.
What this CSV sorter does
It reorders the rows of a delimited file and changes nothing else. Every option below exists because a real file needed it.
- As many sort keys as you need. The first key is the primary order; each one under it breaks ties in the one above, with its own type and its own direction.
- Four ways to compare. Number, Text, Date and Length, or Auto, which reads the column and picks.
- A header row you control. Detection is shown with its reason, and Yes and No override it.
- Real CSV parsing. Quoted commas, quoted line breaks, doubled quotes, blank rows and ragged rows all survive the round trip.
- Delimiters and encodings that are worked out, not guessed. Comma, semicolon, tab and pipe; UTF-8, UTF-16 and Windows-1252.
- An export that matches your file. Its delimiter, its line endings, optionally a byte-order mark for Excel, and every untouched row byte for byte.
Sorting by more than one column
A single sort key answers one question. Two or three answer the question people actually have about a spreadsheet.
Sort keys are applied in order. The first decides the position of every row whose value differs; where two rows tie, the second key decides between them, and so on down the list. Rows that tie on every key stay in the order they were in the file — the sort is stable, so running it twice with the same settings gives the same file twice, and a sort you have already applied is never undone by the next one.
Three keys that answer a real question
- Region, then date, then amount. Every region's orders together, oldest first inside each, and the largest first where two landed the same day.
- Status, then customer. Open tickets grouped, alphabetical within the group.
- Category, then price descending. The catalogue arranged the way a price list is read.
The arrows beside each key move it up or down the list, which changes which column wins. That is usually faster than deleting a key and adding it back, and it is the fastest way to see the same data arranged two ways.
Number, text, date and length
The comparison a column needs is a property of the data, not of the tool. Auto reads the column and picks; the four types below force the choice when Auto cannot.
- Number. Compares the value, not the characters. 2 before 10, -5 before 0, and 10.25 before 10.5.
- Text. Alphabetical, using the ordering rules of your language, so accented letters land where a dictionary puts them.
- Date. Chronological. December 2023 before March 2024, whatever format the column is written in.
- Length. Shortest to longest, counting characters. Useful for finding the truncated values and the overlong ones in a column that should be uniform.
Auto samples the column and takes the reading that fits most of it. One stray N/A in ten thousand prices does not turn a money column into a text column — that value is simply placed after every number that did parse.
Why numeric sorting is harder than it looks
Almost every online CSV sorter offers a numeric mode that is really a natural-order text comparison. Natural order walks runs of digits, so it reads 10.5 as ten, a dot, five and 10.25 as ten, a dot, twenty-five, then compares five against twenty-five and puts 10.25 after 10.5. Every value is a number, the output looks confident, and the order is wrong.
What a number can look like in a real export
- 1,200 and 1.200. Grouping separators, either convention.
- 1.234,56 and 1,234.56. Both written the same way round; whichever separator comes last is the decimal point.
- $4.50, £12, 50%. A currency symbol or a percent sign does not stop a value being a number.
- (1,200.00). Accounting negatives in brackets, which no spreadsheet exports any other way.
- 1e3 and -0. Scientific notation and signed zero.
Dates, and the 3/1/2024 problem
Sorted as text, a column of American dates comes out as 1/15/2024, 3/1/2024, 12/1/2023 — December last, after March. Sorted as dates it comes out in the order it happened. That is the whole reason the Date type exists.
Day first or month first
3/1/2024 is the 3rd of January in most of the world and the 1st of March in the United States, and nothing inside the value decides which. So the whole column decides: a first component above 12 proves day-first, a second component above 12 proves month-first. When a column proves neither — every value ambiguous — the tool says so, reads it month-first because that is what an American export produces, and the Date order control switches it in one click.
Formats that are read
- ISO. 2024-03-10, 2024/03/10, with or without a time and a UTC offset.
- Slash, dash and dot. 3/1/2024, 3-1-24, 10.03.2024, with two-digit or four-digit years.
- Month names. Jan 12, 2024 and 12 Jan 2024, in English, Spanish, French, German, Portuguese and Indonesian.
A date that does not exist is not silently moved. 2024-02-31 is rejected rather than read as the 2nd of March, which is what the browser's own date parser does with it.
What makes a CSV hard to read
The comma is not the problem. The quoting rules around it are, and a sorter that gets them wrong reorders damage rather than data.
- The quote character is a setting. Almost every file uses the double quote, and a file written with a single one is read correctly once you say so.
- A quoted field can contain the delimiter. "Smith, John" is one cell. Splitting on commas turns it into two, and every cell to its right lands in the wrong column.
- A quoted field can contain a line break. An address or a note is one row. Splitting on newlines first tears it into two rows and shifts the file underneath it.
- A doubled quote is a literal quote. "He said ""hi""" is He said "hi", not He said hi.
- A blank line is a row. Dropping it changes the row count between what went in and what came out.
- Rows can be ragged. Short and long rows are kept as they are, and counted above the preview so you can see there are some.
How the delimiter is worked out
Counting characters in the first line is the obvious approach and it is wrong: in "Smith, John";42;"Doe, A" there are two commas and two semicolons, and both commas are inside quotes. Instead the file is parsed with each candidate in turn and scored on whether the result is a coherent table — the wrong delimiter gives rows of wildly different widths, the right one gives rows that agree. That test cannot be fooled by quoting, because the parse it scores already respects the quotes.
- Comma. The default nearly everywhere English is the export language.
- Semicolon. What Excel writes wherever the decimal separator is a comma.
- Tab. .tsv, and what pasting from a spreadsheet produces.
- Pipe. Common in database and mainframe extracts, where the data itself contains commas.
Text encoding, and where the mojibake comes from
An encoding dropdown that defaults to UTF-8 is wrong for half the files people have, and one the user has to set is wrong whenever they forget. Detection reads the bytes: a byte-order mark decides outright, UTF-16 without one is recognised by its null bytes, and otherwise the file is decoded as UTF-8 strictly — real UTF-8 passes, a legacy code page does not, because its high bytes do not form valid sequences. Only then does Windows-1252 apply.
- UTF-8, with or without a byte-order mark. What almost every modern export is.
- UTF-16, either byte order. What Excel writes when you choose Unicode Text.
- Windows-1252 and ISO-8859-1. Older Western European exports, where the accents live in single high bytes.
Output is always UTF-8, optionally with a byte-order mark so older versions of Excel open it with the accents intact. Writing a legacy code page back out would silently replace every character it cannot hold, and destroying characters in a file you only reordered is a worse bug than any this rebuild fixed.
What the exported file looks like
By default it is your file with the rows moved. The delimiter, the line endings and the trailing newline are the ones it arrived with, and every row that was not changed is copied out exactly as it came in — original quoting, original spacing, original everything. A sorter that re-quotes every cell will disagree with the source somewhere, and a quoted product code that loses its quotes is a product code Excel eats.
- Output delimiter. Keep the source's, or write commas, semicolons, tabs or pipes. A tab export is named .tsv.
- Line endings. Keep the source's, or force LF or CRLF.
- Byte-order mark. Adds the UTF-8 hint that older Excel builds need to show accents correctly.
- Quote every field. For the strict importers that want it that way.
Speed, and why it matters on a file this size
Sorting is not the slow part of a CSV tool — reading it is, and comparing values one pair at a time is what turns a fast operation into a frozen tab. Here the file is read once when it arrives, every value the sort needs is worked out once, and the ordering itself is arithmetic. Changing a direction or adding a key re-sorts against the file already open rather than reading it again, which is why the preview moves as fast as the control does.
- Half a million rows, 26 MB. Open in about a tenth of a second.
- A number or date column at that size. Ordered in under half a second.
- Grouping by a category. About four hundredths of a second, because a column with few distinct values needs no comparisons at all.
- Half a million different names. A second or two — the slowest thing the tool does, and still quicker than the ordinary way of sorting them.
- Nothing on the main thread. The page stays responsive and Cancel stops the work immediately.
All of it happens on your device. The file is never uploaded, so there is no queue, no size charged by the megabyte and nothing to delete afterwards, and the tool keeps working with the network off.
Half a million rows in a 26 MB file open in about a tenth of a second, and grouping them by a category takes about four hundredths more.
Why sort a CSV before anything else
Sorting is the cheapest thing you can do to a dataset and it makes every later step easier.
- You can see the shape of it. Extremes, gaps and duplicates all move to where you can find them.
- Duplicates line up. Identical rows become adjacent rows, which is what a de-duplicator needs.
- Imports get predictable. A consistently ordered file produces a diff you can read when it is loaded twice.
- Reports read themselves. Grouped by category and dated inside each group is a report, not a dump.
Free and Pro
Everything that makes the sort correct is free. Pro is about scale.
- Free. One file up to 25 MB, up to three sort keys, every type, every direction, every delimiter, every input encoding and every export option.
- Pro. Files as large as your device can handle, fifty at a time delivered as one ZIP, and as many sort keys as you want.
There is no lower-quality free result to raise. A CSV has no resolution to halve and no compression to turn down, so the free tier is limited by how much you sort at once, never by how well.
Getting a clean result
- Check the header control before you sort. It is shown with the reason it decided; a file with no header must not have its first row pinned.
- Look at the type the key resolved to. It is printed under each key, and a column you expected to be numeric showing as text usually means a stray character in it.
- Set Date order if the file is not American. Only needed when the column itself is ambiguous, and the tool tells you when that is.
- Use several keys instead of sorting twice. Two passes work because the sort is stable, but one pass with two keys says what you meant.
- Keep the source's delimiter unless something downstream needs otherwise. It is the setting that keeps the export byte-identical to the input.
Frequently asked questions
How do I sort a CSV by column?
Drop your CSV or paste it in, pick a column under Sort keys, choose a direction, and press Sort. The rows reorder on your device and a detected header row stays on top. You can add as many further keys as you need to break ties, watch the result in the preview table, then download or copy the whole sorted file.
Can I sort by more than one column?
Yes, and not just two. Add a key for each column you want to order by; the first is the primary sort and each one below it breaks ties in the one above. Every key has its own type and its own direction, so you can sort by region A to Z, then by date newest first, then by amount high to low. The up and down arrows reorder the keys, which changes which one wins.
Why did my numbers sort in the wrong order before?
Most CSV sorters compare numbers as text with a natural-order rule, which walks runs of digits rather than reading the value. That puts 10.25 after 10.5, and it cannot make sense of 1,200, $4.50, (300) or 1e3 at all. This tool parses the actual number, including thousands separators, currency symbols, accounting negatives in brackets, percentages and both the decimal point and the decimal comma. Set a key's type to Number to force it, or leave it on Auto and the column decides.
Can it sort by date?
Yes. Set a key's type to Date, or leave it on Auto — a column of dates is recognised and ordered chronologically rather than alphabetically, so December 2023 comes before March 2024 instead of after it. ISO dates, slash and dot dates, two-digit years and month names in all six of this site's languages are all read. Where a value like 3/1/2024 is genuinely ambiguous the whole column decides between day-first and month-first, the tool says which reading it used, and Date order lets you override it.
Is the header row kept at the top?
Yes, when there is one. Row one is examined against the rows below it — a column of numbers or dates whose first value is a word is a labelled column — and the result is shown next to a Header row control with Auto, Yes and No. That control matters: a file with no header must not have its first row pinned in place, and one that does must not have its labels sorted into the middle of the data.
What happens to quoted fields, blank rows and ragged rows?
They survive. A quoted field containing a comma, a line break or a doubled quote is one cell, not two rows; a blank line between sections stays a blank line; and rows with more or fewer cells than the rest are kept exactly as they are and counted for you above the preview. Nothing is padded, trimmed or re-quoted, because a sort should change the order of a file and nothing else.
Which delimiters, encodings and file types work?
Comma, semicolon, tab and pipe, detected by parsing the file with each and keeping whichever produces a coherent table — so a European export full of quoted commas is not mistaken for a comma file. Text is read as UTF-8, UTF-16 with or without a byte-order mark, Windows-1252 or ISO-8859-1, detected from the bytes. The file dialog accepts .csv, .tsv, .psv, .tab and .txt, and anything else is refused with a link to the tool that does handle it.
Where do blank cells and unsortable values go?
Values that parse go first in the direction you chose, values that have content but do not parse as that type — an N/A in a column of prices — go after them, and blank cells go last. Blank cells first is a checkbox if you want the other arrangement. Direction never moves them: reversing a sort orders the values the other way round and leaves the blanks at the end, which is what a spreadsheet does and what people expect.
How big a file can it handle, and is it private?
Free sorts one file up to 25 MB, which is roughly half a million rows, in a few hundred milliseconds. Pro raises the size to whatever your device can handle, allows fifty files at once delivered as one ZIP, and lifts the three-key limit. Everything runs on your device — the file is never uploaded, never stored and never seen by anyone else — and it keeps working offline once the page has loaded.
from 98 ratings
Rate this tool
Tap a star — it takes a second