Skip to main content
FileForge

Sort Text Lines

Put any list in order: alphabetical (A–Z or Z–A), natural numeric order, or by line length — with one click.

Runs in your browser — files never leave your device

Free · No sign-upOutputs Plain text
Loading tool…

How to use Sort Lines

  1. Paste your lines into the input box.

  2. Pick a sort: A–Z, Z–A, natural/numeric, or by length.

  3. Toggle case-insensitive if capitalization shouldn't matter.

  4. Click Sort lines and copy the result.

About this tool

Plain alphabetical sorting puts "item10" before "item2" because it compares character by character. The natural sort option here compares embedded numbers by value, producing the order humans expect. You can also sort case-insensitively, reverse any order, or sort by line length, which is useful for reviewing data exports and organizing word lists.

This comes up often when working with exported data or file listings — sorting a folder of numbered files correctly (file2 before file10), alphabetizing a list of names for a directory, or arranging entries by length to spot unusually short or long outliers.

Common ways people use this

  • Sorting a list of numbered files or items so they appear in the order a person would expect (2 before 10)
  • Alphabetizing a list of names, products, or entries for a directory or catalog
  • Sorting by line length to quickly spot unusually short or long entries in a data export

Tips for better results

  • Use natural/numeric sort whenever your list contains numbers embedded in text, like file names or version numbers — plain alphabetical sort will order them incorrectly.
  • Sorting by length is a quick way to audit a list for outliers, like an accidentally truncated entry or an unusually long one that needs review.

Frequently asked questions

Why does normal sorting put item10 before item2?
Character-by-character comparison sees "1" before "2" and stops there. Choose the natural sort option to compare the numbers by value: item2, then item10.
How are empty lines handled?
Empty lines sort to the top in ascending order. If you don't want them, remove blank lines first with the Remove Extra Spaces tool.
Does sorting handle accented characters sensibly?
Yes — locale-aware comparison places accented letters next to their base letters (é near e) instead of at the end of the alphabet.
Can I sort a list in reverse alphabetical order?
Yes, choose the Z–A option to get the exact reverse of standard alphabetical order.
Will sorting remove duplicate entries?
No, sorting only reorders the lines — duplicates stay in the list. Use Remove Duplicate Lines first if you also want to deduplicate.