— Natural Sort Lines

Natural Sort Order Tool

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 alphanumeric text in human-intuitive order (item2 before item10).

Examples

Input
file1
file10
file2
file20
Output
file1
file2
file10
file20
Input
v1.9
v1.10
v1.2
Output
v1.2
v1.9
v1.10
Input
img1
img12
img3
img21
Output
img1
img3
img12
img21
Input
Chapter 1
Chapter 11
Chapter 2
Output
Chapter 1
Chapter 2
Chapter 11

Frequently Asked Questions

Natural sort order treats embedded numbers as actual numbers rather than text. While alphabetical sorting puts "item10" before "item2" (because 1 < 2 as characters), natural sorting puts "item2" first because 2 < 10 as numbers.

Standard sorting compares character by character. When comparing "file2" vs "file10", it compares "2" vs "1" as characters. Since the character "1" comes before "2", file10 incorrectly sorts before file2. Natural sorting avoids this by treating number sequences as numbers.

Natural sort handles version numbers intuitively. Version 1.10 correctly comes after 1.9 (since 10 > 9). The dots are treated as separators, and each number segment is compared numerically: 1.2, 1.9, 1.10, 1.11, 2.0.

Yes, leading zeros are handled naturally. "file01" and "file1" are treated equivalently (both represent the number 1). Items like "item001", "item01", and "item1" sort together based on their numeric value.

You can choose case-sensitive or case-insensitive natural sorting. Case-insensitive sorting groups "Apple", "apple", and "APPLE" together, which is typical for file system sorting. Case-sensitive sorting separates uppercase and lowercase.

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