Sort numbers numerically, not alphabetically
The number sorter lets you sort numbers by their value, from smallest to largest or the reverse. A plain text sort compares characters, which puts "100" before "9" because "1" comes before "9". This tool reads each number as a value, so 9 comes before 100, negatives come before zero and decimals land where they belong.
Example
Input: 42, 7, 3.14, -10, 1e3, 7, 256
99 0.5
Ascending: -10 0.5 3.14 7 7 42 99 256 1000
Descending, duplicates removed:
1000, 256, 99, 42, 7, 3.14, 0.5, -10
The output above is shown on one line to save space; by default each number goes on its own line.
Which numbers are recognized
You do not need a clean list. The tool scans the text and picks out anything that looks like a number, ignoring words and other characters around it:
- Integers and decimals:
42,3.14,.25 - A leading sign:
-10,+5 - Scientific notation:
1e3(1000),2E-2(0.02)
Numbers are output in normalized form: 1e3 becomes 1000, 7.0 becomes 7, 0.50 becomes 0.5 and +5 becomes 5. Duplicate removal compares values, so 7 and 7.0 count as the same number.
Why numbers sort wrongly elsewhere
The alphabetical trap described above appears in many everyday tools, and each has its own fix:
- JavaScript:
[10, 9, 100].sort()returns[10, 100, 9], because the default sort compares strings. Pass a comparator:.sort((a, b) => a - b). - Python: numbers read from a file are strings until converted, so use
sorted(lines, key=float). - Excel and Google Sheets: numbers stored as text (often marked with a small green triangle) sort as text. Convert them with
VALUE()or the "Convert to number" option first. - Command line:
sort -nsorts numerically, and GNUsort -galso understands scientific notation such as1e3.
When you only need a quick, correct result from pasted text, this page avoids all of these steps.
Common mistakes
| Input | Read as | Why |
|---|---|---|
1,000 | 1 and 0 | The comma is treated as a separator |
3,14 (decimal comma) | 3 and 14 | Only a period is a decimal point |
10-20 | 10 and -20 | The hyphen reads as a minus sign |
2.5.1 | 2.5 and 0.1 | Version numbers are not single numbers |
0x1F | 0 and 1 | Hexadecimal is not supported |
Remove thousands separators and convert decimal commas first. The text replacer can do that in one pass. Put a space around range hyphens so that 10 - 20 is read as two positive numbers.
Precision
Values are stored as standard 64-bit floating-point numbers, the same as JavaScript. Integers up to 9,007,199,254,740,991 (2⁵³ − 1) are exact. Beyond that, digits get rounded: 9007199254740993 is shown as 9007199254740992. Very large values such as 10²¹ appear in exponent form (1e+21).
Related tools
To sort lines of text alphabetically or in natural order, use sort text lines. To create test data to sort, try the random number generator, and to remove repeated lines without sorting use remove duplicate lines.
Privacy
The processing runs entirely in your browser. The text you enter is not uploaded to a server.