Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. CSV & Data Analysis
  3. CSV Sorter
Add to favorites

CSV Sorter

Sort by any number of columns, with the comparison stated: numbers by value, dates by day, text by a collation you choose

Rows never leave your deviceMore csv & data analysisJump to full guide

Initializing in your browser…

You might also like

CSV Column Filter

Keep and reorder chosen columns, with the list built from the widest row so a field beyond the header is not dropped

CSV Data Type Detector

Classify every column against a decider rather than a regex: calendar-checked dates, RFC 4291 addresses, and leading zeros kept out of integer columns

CSV Column Renamer

Rename columns under a stated convention, with two that would end up with the same name numbered rather than left to collide

A sample run

A price list has to go Category ascending, then Price high to low. The price column holds a grouped thousand, an N/A and a blank, which is what makes the ordering a decision rather than a formality.

Two rules: Category ascending as Text, Price descending as Number

Keyboard,Accessories,129.99
Mouse,Accessories,N/A
Laptop,Electronics,999
Monitor,Electronics,"1,299"
Webcam,Accessories,89
Cable,Accessories,
What CSV Sorter produces

Sorted

Keyboard,Accessories,129.99
Webcam,Accessories,89
Mouse,Accessories,N/A
Cable,Accessories,
Monitor,Electronics,"1,299"
Laptop,Electronics,999

The rule reads: 4 values sort by number, 1 could not be read as number, 1 blank, and those go last.

Inside Accessories the two prices run high to low, then the value that is not a number, then the blank, and they stay at the end even though the direction is descending. 1,299 is read as one thousand two hundred and ninety nine rather than as 1, which is what parseFloat returns for it. Text compares by Unicode code point, so the same file sorts the same way for every reader rather than following whoever opened it.

About the CSV Sorter

Sort a CSV by any number of columns, with the comparison written out on the page rather than guessed. Numbers sort by value, dates by the day they name, text by an order that is the same for every reader, and anything that cannot be read as the column’s type is told to you rather than quietly given a place.

How to use

  1. 1Upload your CSV, or click a column header to sort by it straight away
  2. 2Add a rule per column: the first decides and the ones below it break ties
  3. 3Read what the rule says it decided, and change the ordering if it is not what you meant
  4. 4Download the sorted file

Key features

  • Any number of sort rules, each with its own direction and ordering
  • Numbers, dates, natural order, length, and text, with the rule in force written out
  • A stated text collation: Unicode code point by default, or a language you choose
  • Blanks and unreadable values counted, and placed at the end you ask for in both directions
  • Ties keep the file order, and the page re-checks that the output really is sorted

How it works

A sorter is only correct with respect to a comparison, so this one states its comparison and checks its own output against it. Every cell gets a sort key once, before anything is compared, and the comparison is a lexicographic walk over those keys. That is what makes the order transitive: there is no branch that can compare one pair of rows one way and the next pair another. It also means a column is read once rather than once per comparison, so 100,000 rows sort in about a fifth of a second.

Each rule picks a column, a direction and an ordering. Automatic looks at the column and says what it chose and why: all numbers, all dates, digits mixed with text, or none of those. Number reads a decimal literal with the decorations a spreadsheet adds (grouped thousands, a currency symbol, a percent sign, accounting parentheses) and nothing else, so 12abc is not the number 12 and 0x1F is not zero. Date reads calendar dates, so 29 February in a common year is not a date, and the day/month order is settled by the whole column with the cell that proved it named on the page. Natural makes item2 come before item10. Length counts characters as Unicode code points.

Text compares by Unicode code point by default, which is deliberate: a locale collation puts the same file in a different order for a Swedish reader, where the ring-A sorts after Z, than for a German one, where it sorts with A. If you want a language’s own alphabetical order you choose the language and the page says which one is in force. Case is a value rather than a tie, so apple, Apple and APPLE get three places instead of one, unless you ask for a case-insensitive collation.

Blank cells, and values that cannot be read as the column’s ordering, are counted separately and go to one end whichever direction the values are sorted in, which is the convention SQL calls NULLS LAST; you can put them first instead. Rows that tie on every rule keep the order they had in the file. After every sort the page re-checks that the result really is in order under the comparison it just described, and says so.

Where this fits a data pipeline

  • Preparing ranked lists

    Sort by revenue or score, with the rows that have no number in them collected at the end rather than scattered through the ranking.

  • Chronological ordering

    Sort a date column by the day it names, including day-first dates that the JavaScript Date constructor refuses outright.

  • A file two people have to agree on

    Code point order does not depend on the reader’s browser locale, so two people sorting the same file get the same file.

Tips & best practices

  • Automatic tells you what it decided and why, including how many values it could not read. If that number surprises you, the column is not what you thought it was.
  • A day/month column is settled by the whole column: one cell with a day above 12 proves the order for every row, and the page names that cell.
  • Code point order is the default so the file sorts the same way for everyone. Switch to a language collation when you want alphabetical order for readers of that language, and expect a different result.

Examples

  • Cheapest last within each category

    Rule 1 is Category ascending as Text and rule 2 is Price descending as Number. Rows group by category and then run high to low inside each one, so the cheapest item in a category is the last of that group.

  • Natural order for filenames

    A column of item2, item10, item1 sorted as Natural gives item1, item2, item10. Automatic picks Natural on its own when every value mixes digits with other characters.

  • A column that is not all numbers

    A price column holding 999, 1,299, N/A and a blank sorts the two numbers by value, then N/A, then the blank, and the rule says "2 values sort by number, 1 could not be read as number, 1 blank, and those go last".

Frequently asked questions

Does it handle numeric sorting correctly?

Yes, and it says what counts as a number. A cell is read as a number only if it is a decimal literal, possibly with grouped thousands, a currency symbol, a percent sign or accounting parentheses. 12abc and 0x1F are not numbers here, where parseFloat reads them as 12 and 0.

How are day-first dates like 15/01/2024 handled?

The whole column decides. Any cell whose first field is above 12 proves the column is day first, and the page names that cell. The JavaScript Date constructor refuses 15/01/2024 outright, which is why a date sort of a European column used to come out half sorted.

Why is uppercase sorted before lowercase?

That is Unicode code point order, which is the default because it is the same for every reader. Turn on Ordering options and choose a language to get that language’s alphabetical order instead, where case usually does not separate values.

Where do empty cells go?

Last by default, in both directions, along with any value that could not be read as the column’s ordering. Both are counted and shown. You can put them first instead.

Are rows that tie left alone?

Yes. Rows equal under every rule keep the order they had in the file, ascending or descending.

Private by design

Rows and columns are parsed and transformed in memory in your browser. No record ever reaches a server.