How to Sort a List of Numbers Correctly (Not Alphabetically)

You sort a list of numbers and get 1, 10, 100, 2, 25, 3 instead of 1, 2, 3, 10, 25, 100. Nothing is broken - this is a text sort being applied to values that are technically text, not numbers, even though they look like numbers to you.

Quick answer

A standard alphabetical sort compares numbers character by character, so '10' sorts before '2' because '1' comes before '2' as a character. To sort correctly, you need a numeric sort that parses each value and compares actual magnitude. Paste your list into Text Fixer and choose the 0→9 (or 9→0) sort option instead of A→Z.

Sort your list numerically now. Free, no account needed.

Open Text Fixer →

Why this happens

A text (alphabetical) sort compares strings character by character, left to right - the same way a dictionary orders words. When it compares "10" and "2", it looks at the first character of each: "1" comes before "2", so "10" sorts first - the fact that ten is numerically larger than two never enters into it, because the sort has no concept of "value," only characters.

This shows up constantly with data pulled from a CSV export, copy-pasted from a web page, or any column that was formatted or typed as text at some point rather than as a genuine number.

How to fix it without Excel

  1. Paste your list into Text Fixer. One value per line.
  2. Choose 0→9 (ascending) or 9→0 (descending) from the sort options, instead of A→Z or Z→A.
  3. Copy the result. Every value is parsed as a number and sorted by actual magnitude.

A list like this:

10
2
100
1
25
3

sorted 0→9 becomes:

1
2
3
10
25
100

The Excel alternative, for comparison

If you're working directly in a spreadsheet, Excel's standard fix is Text to Columns: select the column, go to Data → Text to Columns, choose Delimited, uncheck all delimiters, and set the column format to General on the final step. This forces text-formatted numbers into real numeric values Excel can sort correctly. The VALUE() function in a helper column achieves the same thing without altering the original column.

Both work well if you're already in Excel and want the fix to live in the spreadsheet. Pasting into a numeric sort tool is faster when the list is a one-off - a set of IDs from a support ticket, a column copied out of a report - and you just need it sorted correctly right now, not converted as part of a permanent spreadsheet.

Mixed numeric and non-numeric lists

If your list has some purely numeric lines and some that aren't (labels, blanks, IDs with letters in them), the numeric sort still works predictably: numeric lines are sorted by value first, and any non-numeric lines are grouped afterward in alphabetical order rather than causing an error or getting dropped.

Decimals, negatives, and leading zeros

Decimal values (3.14) and negative numbers (-12) sort by their actual value the same as whole positive numbers. Leading zeros (007) are parsed by numeric value for sorting purposes - 007 sorts as 7 - though the zeros themselves stay in the text output; only the comparison uses the numeric value underneath.

Cleaning up other formatting issues too?

Data Cleaner handles currency symbols, inconsistent decimals, and messy nulls in one pass.

Open Data Cleaner →

Frequently Asked Questions

Why does my list of numbers sort as 1, 10, 100, 2 instead of 1, 2, 10, 100?
This is an alphabetical (text) sort being applied to values that are being read as text rather than numbers. A text sort compares characters left to right, so "10" sorts before "2" because "1" comes before "2" as a character - the actual numeric value never gets considered.
How do I sort a pasted list of numbers correctly without opening Excel?
Paste the list into Text Fixer and choose the 0→9 (or 9→0) sort option instead of A→Z. It parses each line as a number and sorts by actual value, regardless of how many digits each one has.
What's Excel's fix for this, and why use a browser tool instead?
Excel's standard fix is Text to Columns (Data tab → Text to Columns → General format) to force text-formatted numbers into real numbers before sorting, or wrapping values in a VALUE() formula. Both work, but require opening a spreadsheet and running a multi-step conversion for what's often a one-off list. Pasting into a numeric sort tool skips that entirely.
What happens to non-numeric lines in a numeric sort?
They're grouped after all the numeric ones and sorted alphabetically among themselves, rather than being dropped or causing an error. So a list mixing numbers and labels still produces a usable, predictable order.
Does this handle decimals and negative numbers?
Yes. Values like 3.14, -12, and 0.5 are all parsed as their actual numeric value and sorted correctly alongside plain integers - not just whole positive numbers.
What about numbers with leading zeros, like 007 or 042?
They're parsed by numeric value for sorting purposes (007 sorts as 7), which is usually what you want for a numeric sort. If you need to preserve the leading zeros in the output itself rather than just the sort order, they aren't stripped from the text - only the comparison uses the numeric value.
Can I sort numbers descending (largest first)?
Yes, select the 9→0 option instead of 0→9. Non-numeric lines are still grouped after the numeric ones either way.
Why does this happen in the first place - why would numbers be text?
Usually because the list came from a CSV export, a copy-paste from a web page, or a column formatted as text at some point - all of which store the numbers as literal character strings rather than a numeric type. Nothing is wrong with your data; it's just that the sort algorithm being used doesn't know to interpret it as numbers.

Share this tool

Featured on ToolDirs
© 2026 ListDiff

Free online list and text processing tools.