---
title: "CSV Sorter - Sort Rows by Column Online | CanDoYa"
description: "Sort CSV rows by one or more columns as text, numbers, or dates. Preview, copy, and download the result privately in your browser."
url: https://candoya.com/tools/csv-sorter/
locale: en
type: browser-tool
---

# Free CSV Sorter

Category: Developer

## What is a CSV sorter?

A CSV sorter reorders complete data rows by the values in one or more columns. Choose text, number, date, or automatic comparison, set each direction, and preview the result before copying or downloading it. Quoted fields stay intact, and the file is processed locally in your browser.

CSV values are text, but useful ordering depends on what that text represents. Alphabetical comparison puts 10 before 2, while numeric comparison does the opposite. This sorter lets you choose the meaning of each key or use automatic detection when every nonblank value has one clear type.

Add secondary keys to make tied rows predictable, such as region ascending and revenue descending. Comma, semicolon, tab, and pipe input are supported. The export keeps the detected delimiter, protects fields that contain separators or line breaks, and never uploads the source.

## How to use it

1. **Add your data** - Paste CSV text, choose a local file, drop one into the widget, or load the example.
2. **Confirm the structure** - Auto-detect or select the delimiter and say whether the first row contains column names, then prepare the CSV.
3. **Set the sort keys** - Choose a column, comparison type, and direction. Add up to three secondary keys to break ties.
4. **Check and export** - Review the sorted rows and resolved automatic types, then copy or download the complete result.

## Who it's for

- **Analysts** ordering exports by date, amount, score, or customer before review.
- **Operations teams** grouping rows by region or status, then ranking each group with a secondary key.
- **Developers** creating deterministic fixtures and stable diffs without changing quoted field content.
- **Spreadsheet users** sorting a CSV or TSV quickly without importing it into a workbook.

## Expert note

The sorter decorates every data row with its original position and uses that position as the final comparison key. Equal rows therefore remain stable even on older JavaScript engines, while blank values stay at the end in both ascending and descending order.

## Frequently asked questions

### Is my CSV file uploaded?

No. File reading, parsing, sorting, preview, copy, and download all happen in your browser. The source rows are not sent to a conversion service. The page accepts up to 5 MB, 100,000 data rows, and 500 columns to keep the local workflow responsive.

### Is this CSV sorter free?

Yes. You can sort by up to four columns, choose a type and direction for every key, and export the complete result without payment or an account. The limits shown in the widget are practical browser memory and responsiveness safeguards, not a paid-plan gate.

### Can I sort a CSV by multiple columns?

Yes. Add sort keys in priority order. For example, choose Region ascending first and Revenue descending second. The second key only compares rows whose region values are equal. You can use up to four unique columns, and equal rows keep their original relative order.

### How do I sort CSV numbers correctly?

Choose Number for the column so 2 sorts before 10 in ascending order. Automatic also selects numeric comparison when every nonblank value is a valid finite number. If an explicit numeric column contains text, the tool identifies the source row and asks you to fix it or choose Text.

### How are CSV dates sorted?

Choose Date to compare recognized calendar values by timestamp rather than alphabetically. Clear formats such as 2026-05-12 and ISO date-times are the safest. Automatic uses date comparison only when every nonblank value looks like a date; mixed or ambiguous columns fall back to natural text ordering.

### What happens to blank cells when sorting?

Blank values stay after filled values in both ascending and descending order. This avoids moving incomplete records to the top when you reverse a sort. If two rows are otherwise equal, their original order is retained by the stable final comparison.

### Does it handle commas, quotes, and line breaks inside cells?

Yes. The parser recognizes separators and line breaks inside double-quoted fields and converts doubled quotes to literal quote characters. Export quotes those fields again and uses CRLF record endings, so a customer such as Lovelace, Ada stays in one cell and one row.

### Can I sort TSV or semicolon-separated data?

Yes. Leave delimiter selection on automatic or choose comma, semicolon, tab, or pipe. The sorted export keeps the prepared source delimiter, and TSV uploads receive a .tsv download name. All cell values remain text until a selected comparison rule interprets them for ordering.

## Related tools

- [CSV Viewer](https://candoya.com/tools/csv-viewer/)
- [CSV Editor](https://candoya.com/tools/csv-editor/)
- [CSV Column Extractor](https://candoya.com/tools/csv-column-extractor/)
- [CSV Deduplicator](https://candoya.com/tools/csv-deduplicate/)
- [CSV Statistics](https://candoya.com/tools/csv-statistics/)

---

*Markdown edition of <https://candoya.com/tools/csv-sorter/>, published for AI agents and other automated readers. Index of key pages: <https://candoya.com/llms.txt>.*
