How to use the csv sorter
- Paste your CSV data into the first box. A comma, semicolon, tab or pipe between fields is detected for you.
- Tick First row is a header if the top row names the columns, then pick the column to sort by from the list of names.
- Choose whether to compare as text, numbers or dates, or leave it on Detect it, and choose the order.
- Read the sorted rows in the result box. Copy sorted CSV or Download file to keep them.
Text, numbers and dates sort differently
Sorting numbers as text puts 12.99 before 3.25, because the character 1 comes before 3. That is why the tool detects the type: if every filled cell in the column is a number, it sorts as numbers, and if every cell is a date in YYYY-MM-DD form (with an optional time), it sorts as dates. Otherwise it sorts as text without regard to capital letters, unless you ask for capital letters to sort first.
In the example, the Price column sorted from smallest gives 1.75, 3.25, 4.50, 12.99, 24, while forcing text order gives 1.75, 12.99, 24, 3.25, 4.50. Numbers can include commas, a currency sign in front or a percent sign.
Ties, blanks and quoted fields
Rows with the same value keep their original order, so sorting by one column and then another works the way you would expect in a spreadsheet. Blank cells and cells that do not fit the chosen type go to the end whichever direction you pick, and the tool tells you how many there were.
Fields in double quotes can contain commas and line breaks, and the sorted result is written back with quotes only where they are needed. If you need to reshape the data first, try the CSV transpose tool, the delimiter changer or the CSV and JSON converter.
Limits and privacy
The tool handles up to 2,000,000 characters. The data is sorted in your browser and nothing is uploaded. For summary numbers on a column, the CSV statistics viewer is the next step, and the CSV validator checks that the file is well formed.
Assumptions and limits
- Quoted fields follow the usual CSV rules, with two double quotes standing for one inside a field.
- Dates must be in YYYY-MM-DD form to sort as dates. Other date styles sort as text.
- Text comparison goes by character code, not by language rules, so accented letters sort after plain ones.
- Nothing is uploaded or stored, and the input is limited to 2,000,000 characters.
Frequently asked questions
How do I sort a CSV file by a column?
Paste the data, pick the column from the list and choose the order. The sorted rows appear straight away and you can copy them or download them as a CSV file.
Why does my number column sort in the wrong order?
If it is compared as text, 12 comes before 3. Choose Numbers under Compare as, or leave it on Detect it, which uses numbers when every filled cell is numeric.
Does the header row move?
No. With the header option ticked, the first row stays at the top and is used to name the columns in the list. Clear the box if your data has no header.
What happens to blank cells?
Rows with a blank cell in the sort column go to the end in both directions, in their original order, so the sorted part stays together at the top.