Skip to main content
CaseSwitch

Number Sorter

Use the CaseSwitch Number Sorter to sort numbers numerically (1, 2, 10) instead of lexicographically (1, 10, 2). Paste one number per line, choose ascending or descending, and copy the result. Sorting runs in this browser.

Written by the CaseSwitch editorial team. We maintain these tools in the browser so drafts, keys, and images stay on your device.

Last reviewed: 23 July 2026

Processed locally in your browser. Nothing is sent to a server.

Paste or type text to convert. Output stays empty until there is input.

Character count: 0 · Word count: 0 · Line count: 0

Examples

Ascending fixes lexical order

Input

10
2
1

Output

1
2
10

Descending

Input

1
2
10

Output

10
2
1

Decimals

Input

3.5
1.25
2

Output

1.25
2
3.5

Negatives

Input

-1
0
5
-10

Output

-10
-1
0
5

Larger integers

Input

100
20
3

Output

3
20
100

How to use

  1. Paste one number per line.
  2. Choose ascending or descending order.
  3. Copy the sorted list. Fix any line that is not a valid number if you see an error.

What this tool is for

Spreadsheet pastes and log values often sort wrong when treated as text. This tool parses each line as a number and sorts ascending (default) or descending. Non-numeric lines fail the whole sort with a clear error so bad cells do not silently vanish mid-list.

How it works

Input is split on newlines (or another delimiter if set). Each trimmed token must parse with `Number(...)`. NaN values error out. Valid numbers sort with a numeric comparator, then join with newlines again.

When to use it

Cleaning a column of scores, preparing test fixtures, ranking IDs pasted as text, and fixing the classic `10` before `2` lexical mistake.

When not to use it

Do not sort version strings (`10.2` vs `9.4`) as simple floats without a version parser. Do not sort phone numbers as integers if leading zeros matter — they will not survive numeric parse the way you expect.

How it compares to related tools

Sort Words Alphabetically is for text. Duplicate Line Remover dedupes without numeric ordering.

Common mistakes

Locale decimal commas (`1,5`) parsing wrong. Mixing hex with decimal. Expecting blank lines to be kept — empty lines are filtered.

Numeric vs alphabetical sort

Alphabetical sort compares characters: `10` starts with `1`, so it can appear before `2`. Numeric sort compares magnitudes, so `2` precedes `10`. If you still see lexical order, the values did not parse as numbers.

Decimals and locales

Use a dot decimal (`1.25`). Comma decimals from some locales will not parse as JS numbers here — normalize first. Scientific notation that `Number` understands will sort as numbers.

Frequently asked questions

Why did 10 come before 2?+

That is alphabetical sort. This tool parses numbers so 2 precedes 10 in ascending mode. If you still see lexical order, check that values parsed as numbers.

Can I sort decimals?+

Yes when they parse as JS numbers. Use a dot decimal unless you normalize commas first.

What if one line is not a number?+

The sorter errors and asks for one valid number per line instead of silently dropping bad rows.

Does descending reverse ties stably?+

Equal numbers stay equal. Order among exact ties follows the engine’s sort stability for equal keys.

Can I sort versions like 1.10.0?+

Not correctly as plain floats. Use a version-aware sorter for semver.

Is my list uploaded?+

No. Sorting runs in this browser.

Does this tool send my payload to CaseSwitch?+

No. Formatting, encoding, and naming conversions for this page run in your browser after load — your sample stays on the device.

Related tools