FormatterHQ

Number Sorter

Sort a list of numbers numerically, smallest to largest or largest to smallest, with optional duplicate removal and your choice of separator.

Input TEXT
Output TEXT
Ready.

How to use the Number Sorter

  1. Paste your numbers, separated by commas, spaces or line breaks.
  2. Choose ascending or descending order.
  3. Optionally remove duplicates and pick an output separator.
  4. Copy the sorted list.

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 -n sorts numerically, and GNU sort -g also understands scientific notation such as 1e3.

When you only need a quick, correct result from pasted text, this page avoids all of these steps.

Common mistakes

InputRead asWhy
1,0001 and 0The comma is treated as a separator
3,14 (decimal comma)3 and 14Only a period is a decimal point
10-2010 and -20The hyphen reads as a minus sign
2.5.12.5 and 0.1Version numbers are not single numbers
0x1F0 and 1Hexadecimal 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.

Frequently asked questions

Why does 100 come before 9 in other sorters?
Alphabetical sorting compares text character by character, and "1" comes before "9". A numeric sort compares values, so 9 is placed before 100.
Can I sort numbers with thousands separators?
Not directly, because the comma in 1,000 is read as a separator between 1 and 000. Remove the thousands separators first, then sort.
Does the number sorter handle negative numbers and decimals?
Yes. Negative numbers, decimals such as 3.14 or .5, and scientific notation such as 1e3 are all recognized and sorted by value.
How do I sort numbers from largest to smallest?
Choose descending order. You can also remove duplicates and choose whether the output is one number per line, comma separated or space separated.

Last updated October 3, 2026

Related tools