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
10 2 1 20
1 2 10 20
Price: $15 Price: $5 Price: $100
Price: $5 Price: $15 Price: $100
-5 10 -20 0
-20 -5 0 10
3.14 2.5 3.0 2.75
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.
Related Tools
Sort Lines by Length
<p>Our Sort by Length tool organizes lines of text from shor...
Natural Sort Lines
<p>Our Natural Sort tool arranges text the way humans expect...
Extract Unique Lines
<p>Our Unique Lines tool removes duplicate lines from text,...
Sort Lines A–Z
<p>The Sort Lines A-Z tool arranges the lines of your text i...
Sort Lines Z–A
<p>The Sort Lines Z-A tool arranges your text lines in rever...
Sort Lines by Length
Sort lines by their length in ascending or descending order....
Related Articles
How to Sort Lines by Length: Complete Guide for Text Processing
Learn how to sort text lines by their character length. Perfect for organizing lists, cleaning data, and formatting content for better readability.
Read moreNatural Sorting Explained: Sort Text Like Humans Read Numbers
Discover how natural sorting handles numbers the way humans expect. Learn why file1, file2, file10 sort correctly with natural order algorithms.
Read moreSort Lines Numerically: Order Numbers Correctly Every Time
Learn how to sort text lines by their numeric values correctly. Essential for data analysis, report processing, and organizing numerical information.
Read more