Developer tools

Sort CSV by column

Sort CSV rows by any column, A to Z or by number, ascending or descending. Every field keeps its value, and you copy or download the sorted file. It runs in your browser.

Processed in your browser

1. Add CSV

Paste CSV, or open a UTF-8 file.

Drop a UTF-8 CSV or TSV file here

Auto-detect tries comma, semicolon, tab and pipe. Choose explicitly if the preview looks wrong.

2. Choose order

1 is the first column. Preview headings show each column number, even for duplicate names.

Changing input or options clears the result. Choose Sort CSV again to apply them.

Preparing tool…

How to sort a CSV file by column

  1. Add your CSV

    Paste CSV text, drop a UTF-8 file or select Open file. Check the delimiter and header setting.

  2. Choose the order

    Type the Column number, then pick Text or Exact number, Ascending or Descending, and where blank cells go.

  3. Save your result

    Select Sort CSV, check the preview, then Copy CSV or download the sorted CSV or TSV file.

Example: sort by score

Load example sorts a Name, Score, Note table by column 2 as Exact number, ascending. The result is Bob 78, Dana 78, Charlie 85, Alice 092. Bob and Dana tie, so they keep their original order. Alice's score keeps its leading zero, and Charlie's two-line note stays in one field.

With Text comparison the same column sorts character by character, so 092 would come first.

Frequently asked questions

How do I sort a CSV alphabetically?

Type the number of the column, leave Comparison on Text (English order) and Order on Ascending, then select Sort CSV. Upper and lower case sort together unless you tick Match case. Choose Descending for Z to A.

Can I sort by more than one column?

Not in one run: each sort uses one column. Because equal values keep their order, you can sort by the second column first, select Copy CSV, paste the result into CSV text, and then sort by the main column.

How do text and exact number sorting differ?

Text uses English locale rules, with significant accents and optional case sensitivity. Digits sort as characters, so “10” comes before “2”. Locale details may vary with browser Unicode data. Exact number accepts signed decimals and scientific notation such as -2.5 and 1e6, compares every digit without rounding, and ignores surrounding whitespace for comparison only. Currency symbols, grouped numbers, NaN and Infinity produce a record-specific error.

How are blank cells and equal values sorted?

Empty, whitespace-only and missing keys share your chosen first or last placement in both directions. Equal keys keep their original order, and every row retains its original fields.

How do I choose a column with no unique name?

Use its position, starting at 1. The preview numbers columns independently of their header labels. Sort once by column 1 to inspect the table, then change the column number.

Are there file or row limits?

No fixed admission limit is imposed. Input, parsed rows and the download must fit browser memory. Processing runs in your browser; Cancel stops processing. If the browser cannot finish, retry with a smaller input.

Are files uploaded or saved?

No. Processing stays in your browser. The tool does not upload or persist your files. Copy writes to your clipboard only when chosen; download saves only when you choose it. Reset clears the current input and output.

Does sorting change my data?

Only row order changes. Equivalent sort keys remain in their original order. The first row stays fixed when header is enabled. A result already in the requested order says so. Export formatting may differ from the source because every field is quoted and record separators use CRLF. An initial UTF-8 BOM is omitted. Pasted text follows the browser’s newline normalization; open the file to preserve line breaks within quoted fields exactly.