— Sort Lines Numerically

Sort Lines Numerically

Quick Tips

  • This tool runs entirely in your browser - your data stays private.
  • Press Ctrl+V (Cmd+V on Mac) to quickly paste text.
  • Use the Copy button to save your result to clipboard.
  • Bookmark this page for quick access!

Sort lines by numerical value, not alphabetically.

Examples

Input
10
2
1
20
Output
1
2
10
20
Input
Price: $15
Price: $5
Price: $100
Output
Price: $5
Price: $15
Price: $100
Input
-5
10
-20
0
Output
-20
-5
0
10
Input
3.14
2.5
3.0
2.75
Output
2.5
2.75
3.0
3.14

Frequently Asked Questions

Regular alphabetical sorting compares character by character, putting "10" before "2" because "1" comes before "2" as text. Numeric sorting interprets the numbers mathematically, correctly placing 2 before 10.

Yes, the tool can extract numbers from within lines. "Item 5" and "Item 15" sort by their embedded numbers. You can choose to extract the first number found, the number at the start, or the number at the end of each line.

Negative numbers sort correctly: -20 comes before -5, which comes before 0, which comes before positive numbers. The mathematical value determines order, not the presence of a minus sign.

Lines without recognizable numbers can be placed at the beginning or end of the sorted list, or omitted entirely. This option lets you handle header rows, text-only lines, and mixed content predictably.

Yes, decimal numbers sort by their actual value. The sequence 1.5, 2, 1.75, 2.5 correctly sorts to 1.5, 1.75, 2, 2.5. Precision is preserved and doesn't affect sort order incorrectly.

Cookie Preferences

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.

Cookie Preferences

Manage your cookie settings

Essential Cookies
Always Active

These cookies are necessary for the website to function and cannot be switched off. They are usually set in response to actions made by you such as setting your privacy preferences or logging in.

Functional Cookies

These cookies enable enhanced functionality and personalization, such as remembering your preferences, theme settings, and form data.

Analytics Cookies

These cookies allow us to count visits and traffic sources so we can measure and improve site performance. All data is aggregated and anonymous.

Google Analytics _ga, _gid

Learn more about our Cookie Policy