Numeric compare, not string compare
Lines are compared by their numeric value, not by character order. `2` sorts before `10`; `-5` before `-1`; `0.5` before `0.9`. This is the fix for the classic alphabetical-sort bug where `"10"` lands ahead of `"2"` because `"1"` comes before `"2"` in character order.
Parsing uses JavaScript's `parseFloat`, which is lenient: `3.14`, `-7`, `1e3` (= 1000), `.5`, and `42 apples` (reads the leading number, ignores trailing text) all sort correctly. Currency like `$5`, plain words, and empty lines don't parse and return `NaN`. The exact `parseFloat` rules have edge cases (leading whitespace, `Infinity`, hexadecimal prefixes), so treat the safe summary as: if a line doesn't read as a plain number at a glance, don't assume it sorts predictably.
Lines that parse as `NaN` compare as "equal" to everything under the spec's `NaN`-return coercion to 0. Because `Array.prototype.sort` is stable (ES2019+), they keep their input-relative position: if every line is non-numeric, the output is exactly your input. They can block adjacent numeric lines from crossing them, so for a clean number-only result strip non-numeric lines first with a numeric filter. Equal numeric values also keep their input order by the same stable-sort guarantee.
How to use sort numeric values in a list
- 1Enter your list of numbers in the input panel
- 2Select 'Ascending' or 'Descending' from Order
- 3Choose 'Numeric' in Mode for accurate sorting
- 4Toggle 'Case sensitive' if necessary
- 5Copy the sorted list from the output panel
Keyboard shortcuts
Drive ListShift without touching the mouse.
What numeric sort actually does
Numeric value, not character order. Decimals, negatives, and scientific notation all compared as floats.
Real numeric compare, not lexicographic
Lines are compared by numeric value. `2` comes before `10`; `-5` before `-1`; `0.5` before `0.9`. Fixes the classic `"10" < "2"` bug where alphabetical sort puts `10` ahead of `2` because `"1"` precedes `"2"` in character order.
Lenient numeric parsing (parseFloat)
Parsing is prefix-based, so `42 apples` sorts as 42 - the leading number wins and trailing text is ignored. Decimals, negatives, and scientific notation (`3.14`, `-7`, `1e3`, `.5`) all work. Currency, plain words, and empty lines don't parse and return `NaN`. Edge cases of `parseFloat` (leading whitespace, `Infinity`, hex prefixes) have their own rules, so the practical guide is: if a line doesn't read as a plain number, treat its sort position as unreliable.
Equal numeric values keep input order
The ES2019 spec requires `Array.prototype.sort` to be stable, so two lines with the same numeric value retain their original relative order in the output. Useful when lines share a value but differ in trailing annotations you want preserved.
Non-numeric lines keep their input position
Lines that don't parse cleanly as numbers compare as "equal" to everything under the sort's `NaN` handling, which the ES spec coerces to 0. Stable sort means they keep their input-relative position. If every line is non-numeric the output equals the input; in a mixed input they can prevent adjacent numeric lines from crossing them. For a clean number-only result, pre-filter with Filter numbers or remove non-numeric lines manually.
Descending reverses numeric order
Switch Order to descending and the largest numeric values come first. Non-numeric lines behave the same in both directions (still `NaN`, still held in their input-relative position), so descending only visibly affects the numeric items.
Case sensitive is ignored in numeric mode
The Case sensitive toggle only affects alphabetical mode. In numeric mode the comparison is on floats, so case has no meaning - the toggle is inert here and left visible only because the underlying Sort tool shares options across its modes.
Worked example
Five integers in, sorted ascending by numeric value. A string-compare sort would put `12` after `45` because `"1"` follows `"4"`; numeric mode gets it right.
45 12 78 34 56
12 34 45 56 78
Settings reference
How each option changes the output, with the sample above as input.
| Setting | What it does | Effect on the sample |
|---|---|---|
| Order: Ascending | Sorts numbers from smallest to largest | Numbers are ordered as 12, 34, 45, 56, 78 |
| Order: Descending | Sorts numbers from largest to smallest | Numbers are ordered as 78, 56, 45, 34, 12 |
| Mode: Numeric | Sorts based on numeric value | Ensures 12 is before 34, not based on string comparison |
| Case sensitive: On | Considers case for text | No effect on numeric sorting |
| Case sensitive: Off | Ignores case for text | No effect on numeric sorting |