Find your next tool

Browse tools or search by task

Explore JSONToonPro

Number Converter Tools

Number Sorter – Sort Numbers Online

Sort a list of numbers ascending or descending online. See count, sum, minimum, maximum and average automatically in your browser.

Runs locally in your browser. Nothing you paste is uploaded.

Number Sorter workspace

Order

Separator

Input numbers
Sorted (0 numbers)
Sorted result appears here...

How to Sort Numbers Online

Paste a list of numbers and choose the delimiter used by the source. Select ascending or descending order and inspect the output. Invalid entries should be resolved before treating the result as a complete dataset.

Ascending vs Descending Order

Ascending puts smaller values first and descending puts larger values first. Numeric ordering differs from alphabetical ordering, which would place 10 before 2. Negative values should be compared by their numeric magnitude.

Cleaning Duplicates and Mixed Delimiters

Use consistent delimiters and review extra whitespace or blank lines. Duplicate values remain unless you enable the deduplication control. Decimal notation should use a point so commas can remain unambiguous separators.

Summary Statistics: Sum, Min, Max and Average

Count, sum, minimum, maximum and mean summarize the parsed list. The mean is sum divided by count. JavaScript floating-point arithmetic can introduce small rounding differences, particularly with decimal fractions or very large values.

Number Sorting Examples

The list 10, 2, -3 sorts to -3, 2, 10 in ascending order. Repeated 2 values retain repeated entries. Check the count after parsing to make sure the delimiter setting did not omit any intended values.

More examples and technical details

Why Sorting Numbers as Text Gives the Wrong Answer

This is the single most important thing to understand about sorting numbers. Text is compared character by character from the left, so "10" comes before "9" for the same reason "apple" comes before "banana": the first character 1 sorts before the first character 9, and the comparison stops right there without ever looking at the rest of the string.

[1, 5, 10, 2].sort()              -> [1, 10, 2, 5]  wrong
[1, 5, 10, 2].sort((a, b) => a - b) -> [1, 2, 5, 10]  correct

JavaScript is the classic trap here. Array.prototype.sort called with no arguments converts every element to a string before comparing, even in an array of numbers. The fix is to pass a numeric comparator: (a, b) => a - b for ascending, or (a, b) => b - a for descending. The comparator should return a negative number when a comes first, a positive number when b comes first, and zero when the two are equivalent.

The same problem appears far beyond JavaScript. Spreadsheet columns imported as text, database columns declared as VARCHAR instead of INTEGER, and CSV files parsed without type coercion all sort this way. If a sorted list looks like 1, 10, 100, 11, 2, the values are being treated as text somewhere upstream.

Ascending and Descending Order

Ascending order runs from smallest to largest, which is the default nearly everywhere and the right choice for readings you want to scan for a minimum. Descending order runs from largest to smallest and suits rankings, top-N lists, and anything where the interesting values sit at the high end. Negative numbers follow the same rule that they follow on a number line, so -50 is smaller than -3, a detail that string sorting also gets wrong.

The Statistics This Tool Reports

Alongside the sorted output the tool summarises the set. Each figure answers a different question about your data.

StatisticMeaningWhat it tells you
CountHow many values were parsedA quick check that nothing was dropped by bad separators
SumAll values added togetherTotals for quantities, amounts, and durations
MinimumThe smallest valueThe first item once sorted ascending
MaximumThe largest valueThe last item once sorted ascending
MeanThe sum divided by the countThe arithmetic average, the centre of mass of the set

One caution about the mean: it is highly sensitive to outliers. A single extreme value drags it a long way, which is why the mean salary in a small company tells you very little if one person earns ten times everyone else. The median, the middle value once the list is sorted, is robust to that: changing the largest number to something ten times larger does not move it at all. Sorting your data is the first step to reading the median off it, and comparing mean against median is a fast way to spot skew. When the mean sits well above the median, a few large values are pulling it up.

Natural Sort Order for Mixed Text and Numbers

Lexicographic order also produces surprises for strings that contain embedded numbers, which is why a file listing so often looks wrong. Natural sort order fixes this by splitting each string into runs of letters and runs of digits, then comparing the digit runs numerically rather than character by character.

lexicographic: file1, file10, file2, file20, file3
natural:       file1, file2, file3, file10, file20

Modern JavaScript can do this with Intl.Collator using the numeric option, and most operating system file managers apply natural ordering by default. If you control the data, an even simpler fix is zero padding the numbers when they are generated, since file001 through file020 sort correctly under plain text comparison.

Sort Stability

A sort is stable when items that compare as equal keep their original relative order. This is invisible when sorting plain numbers, and essential when sorting records by several keys in turn. To order employees by department and then by name within each department, you sort by name first and then by department: a stable sort preserves the name ordering inside each department group, while an unstable one scrambles it. JavaScript engines have guaranteed a stable sort since ES2019.

Practical Uses

  • Cleaning exported data: pasting a messy column out of a spreadsheet or report and getting a clean ordered list back.
  • Preparing sets for analysis: ordering measurements before reading off the median, quartiles, or range.
  • Deduplicating id lists: duplicates become adjacent once sorted, which makes them trivial to spot by eye or remove in one pass.
  • Reading log data: sorting response times or error codes surfaces the extremes immediately and shows where the range actually sits.
  • Finding gaps in sequences: a sorted list of invoice or ticket numbers makes a missing entry obvious.

Sorting is usually one step in a data cleanup pipeline. Browse the full data and developer tools collection for formatters, converters, and text utilities that handle the rest.

Frequently asked questions

How do I sort a list of numbers?

Paste the list, select its delimiter and choose ascending or descending order.

Can I paste comma- or line-separated values?

Yes. Select the matching comma, whitespace or newline separator.

Can I keep duplicate numbers?

Yes. Duplicate numbers can remain in the sorted output.

Does the tool calculate summary statistics?

Yes. It displays count, sum, minimum, maximum and average for parsed numbers.

Is my list uploaded?

No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.