How to sort numbers
- Paste your numbers into Your numbers. Any mix of commas, spaces, tabs and new lines works as a separator.
- Pick the order: Smallest first or Largest first.
- Switch on Remove duplicates if each value should appear only once.
- Choose how the result is separated, then press Copy.
The tool ignores words and symbols around the numbers, so you can paste a messy line such as “Scores: 42 (Tom), 19 (Ana), 100 (Li)” and get back 19, 42, 100.
Ascending and descending order
Ascending means going up: each number is larger than the one before it. Descending means going down.
| Original | Ascending | Descending |
|---|---|---|
| 42, 7, 19, -8, 3.5 | -8, 3.5, 7, 19, 42 | 42, 19, 7, 3.5, -8 |
Negative numbers are smaller than zero, so they come first in ascending order. The further a negative number is from zero, the smaller it is: -20 comes before -3.
The statistics below the result
Sorting is often the first step in understanding a set of numbers, so the tool also shows:
- Count: how many numbers were found
- Smallest and Largest: the minimum and maximum
- Sum: all the numbers added together
- Average: the sum divided by the count, also called the mean
- Median: the middle value of the sorted list
The median is the number in the middle once the list is in order. With an even count, it is the average of the two middle numbers. It is a better guide than the average when a few values are much larger or smaller than the rest, as with house prices or salaries.
Why sorting as text goes wrong
If you have tried to sort numbers in a text editor or with a basic sort function, you may have seen this:
1, 10, 100, 2, 25, 3
That is alphabetical order. The program is comparing the numbers as words, character by character, so everything that starts with “1” comes before anything that starts with “2”. This sorter compares the numeric values, which gives 1, 2, 3, 10, 25, 100.
Common uses
- Homework: ordering integers, decimals and negative numbers
- Finding the median of test scores or survey answers
- Cleaning data before pasting it into a spreadsheet
- Removing duplicate IDs, order numbers or lottery picks
- Ranking prices, times or measurements
Sorting in a spreadsheet
For data already in Excel or Google Sheets, select the column and use Data, then Sort. To sort with a formula, use =SORT(A1:A20) for ascending order and =SORT(A1:A20, 1, FALSE) for descending order in Google Sheets. For a quick list from an email or chat message, pasting it here is faster.