Sort a CSV file by column

Order the rows of a CSV by one or several columns. Text sorts alphabetically with natural number handling, so item 2 comes before item 10. Switch to numeric sorting for amounts and prices. The sort is stable: rows that tie keep their original order.

Sort CSV tool

Your file stays in this browser tab. It is not uploaded by SheetShift.

CSV file

Drag a file here, or

Options

How to use the Sort CSV

  1. Load a CSV file.
  2. Enter the column to sort by. For a tie-break add a second column after a comma.
  3. Tick "Sort as numbers" for amounts. Tick Descending for the reverse order.
  4. Press Sort and download the result.

Example: input and output

This example was produced by the same code the tool runs, with these settings: columns = price, numeric = true. You can download the sample file(s): items.csv.

Input
item,price,qty
Item 10,4.50,3
Item 2,12.00,1
Item 1,$3.25,8
Widget,7,2
Output
item,price,qty
Item 1,$3.25,8
Item 10,4.50,3
Widget,7,2
Item 2,12.00,1

Result summary: Sorted 4 rows by price (A to Z / low to high).

Supported formats

CSV, TSV, TXT.

Limitations

  • Numeric sort places cells without a readable number after the numbers.
  • Dates are sorted as text. Sort works for ISO dates such as 2026-03-15, but not for 03/15/2026.
  • Several columns use the same direction and sort type.

When this helps

Rank a list

Order an export of products by price, highest first, before sharing the top rows.

Group before review

Sort by country and then by name so related rows sit together.

Frequently asked questions

Why does 10 come before 2 in my sort?

That happens in plain text sorting. This tool uses natural ordering for text, and a numeric mode for values like prices.

Does the header stay on top?

Yes, when the first-row option is ticked.

Can I sort by two columns?

Yes, list them separated by commas. The second column breaks ties in the first.

Related tools

Category: CSV Tools