Words & files

Turn 1, 2, 3 into 1-3

Compress or expand consecutive number ranges

Shorten a long number list, or turn short ranges back into every number.

Free browser tool

Choose what to do with your numbers

Paste whole numbers or ranges, then choose Shorten or Expand.

Processed in your browser

Copy or download the result

No account. No signup.

Worked examples

Number range examples and rules

These examples show exactly what sorting, minimum run length, negative numbers, and descending ranges do.

Number range examples and rules
GoalInput and settingsResult
Compress a basic list1, 2, 3, 7, 8, 9, 15; minimum 31-3, 7-9, 15
Keep a two-number run separate4, 5, 9; minimum 34, 5, 9
Compress negative numbers-5, -4, -3, -2, 4; minimum 3-5--2, 4
Expand in descending order12-10, 20; Expand12, 11, 10, 20

This tool accepts whole numbers only. Expansion is limited to 100,000 output numbers so an accidental giant range cannot freeze the page.

Optional guide Learn more about this tool Open the full explanation and detailed steps.

How to compress consecutive numbers

The tool reads whole numbers, finds runs where each value is exactly one more than the last, and replaces long enough runs with their first and last values.

  1. Paste whole numbers or ranges

    Use spaces, commas, semicolons, or new lines. Negative numbers and descending ranges such as 12-10 are supported.

  2. Choose compress or expand

    Compress can sort and remove duplicates before finding runs. Expand follows each range in the direction it is written.

  3. Choose when a run becomes a range

    A minimum of 3 changes 4, 5, 6 to 4-6 while leaving 9, 10 as two separate values.

Quick example

Compress an ID list

The example turns 1, 2, 3, 7, 8, 9, and 15 into 1-3, 7-9, 15.

Common questions

Shorten a number list FAQ

Can the range compressor handle negative numbers?

Yes. It can compress or expand negative whole numbers, including ranges such as -5--2.

Will the tool sort and remove duplicates?

Those options are on by default when compressing. Turn either one off when the original order or repeated values must be preserved.

What does minimum range length mean?

It is the number of consecutive values required before a run becomes a range. With a minimum of three, 4, 5, 6 becomes 4-6 but 9, 10 stays separate.

Are my number lists uploaded?

No. The list is processed in your browser and is not saved by default. Use Save on this device to keep it here, or download a backup file.