Text Sorter
Sort lines alphabetically, numerically or by length.
Sort lines alphabetically, numerically or by length.
The Text Sorter rearranges line-based data using one of four practical orders: alphabetical ascending, alphabetical descending, numeric ascending or shortest-to-longest. It is handy for lists that need quick cleanup before pasting into another app.
Sorting lines of text alphabetically, numerically or by length transforms an unorganized list into something far easier to scan or cross-reference, which is why it's a common step when cleaning up data exports or contact lists.
For related tasks, try Remove Duplicate Lines, Line Counter or Remove Empty Lines.
The lines “pear”, “apple”, “banana” sorted A–Z become “apple”, “banana”, “pear”.
Sorting the list Banana, apple, Cherry purely alphabetically by standard character order can produce Banana, Cherry, apple rather than the more intuitively expected apple, Banana, Cherry, since uppercase letters come before lowercase in standard ordering.
Alphabetical sorting typically follows standard character-code ordering, which places all uppercase letters before all lowercase letters by default in many systems, so a mixed-case list might not sort in the exact order you'd expect from a case-insensitive sort.
The tool sorts lines alphabetically, numerically or by length. Alphabetical sorting arranges lines in dictionary order, numeric sorting treats the lines as numbers and length sorting puts the shortest or longest lines first. Pick the mode that fits your data. Sorting is the quickest way to tidy a list of names, tags, products or links, and to spot repeated entries that end up next to each other.
Sorting numbers as text gives surprising results. As text, the lines 1, 2 and 10 sort as 1, 10, 2, because the first character is compared first. A numeric sort gives 1, 2, 10. Use numeric sorting for prices, quantities, ages and identifiers that are numbers, and alphabetical sorting for words. Mixed lines such as item 2 and item 10 may need natural sorting, which compares the number part as a value.
Plain text sorting follows character codes, in which capital letters come before lowercase ones, so Zebra can sort before apple. Accented letters such as é or ö may be placed after z. If you need an everyday dictionary order, make the text one case first with the Case Converter. Languages have their own rules for ordering, so a list sorted for one language may look wrong in another.
Sorting is often the first step of a cleanup. Sort a list, remove duplicate lines and then compare it with another list. Reverse the order if you want descending results. For tables with columns, sort the data in a spreadsheet instead, because a line sorter moves whole lines and cannot sort by the second column. Keep a copy of the original order if it carries meaning.
Dates written in the form year-month-day, such as 2026-10-07, sort correctly even as plain text, because the biggest unit comes first. Dates written as day/month/year do not sort correctly as text, since 07/10/2026 would sort before 08/01/2026 even though it is later. Convert to the year-first format before sorting. Prices with currency symbols or thousands separators also sort badly as text, so remove those characters and use numeric sorting. Check the first and last lines of the result to confirm that the order is right.
Sorting by line length is a useful way to find unusual entries. The longest lines in a list of names or titles may be errors, such as two entries pasted together, and the shortest may be incomplete. For a list of slogans or headlines, sorting by length helps you see which ones will fit a limited space. Combine it with duplicate removal to tidy a list, and sort again alphabetically when you need a final presentable order. Keep a copy of the original order if it carries meaning.
Take the list pear, Apple, banana, apple, Cherry. Sorted by character code, capitals come first, so the result is Apple, Cherry, apple, banana, pear. Sorted without regard to case, it is Apple, apple, banana, Cherry, pear, which matches a dictionary. Numbers behave differently: sorted as text, the lines 10, 9, 100 and 1 become 1, 10, 100, 9, because the first characters are compared first, while a numeric sort gives 1, 9, 10, 100. Choose the mode that matches the type of data, and check the first and last lines of the result.
Besides alphabetical and numeric order, you can sort by line length to find the shortest and longest entries, and you can reverse the order for a descending list. If you need to sort by two criteria, such as by category and then by name, a trick is to sort by the secondary key first and then by the primary key, which works when the sort is stable, meaning equal items keep their earlier order. For tables with several columns, a spreadsheet gives more control, because a line sorter moves whole lines and cannot look at the second column.
Some kinds of text sort badly. Dates written as year-month-day sort correctly as text, but day/month/year do not. Version numbers such as 1.10 and 1.2 sort wrongly as numbers, since 1.10 is smaller as a decimal, and they need a natural or version-aware sort. File names such as image2 and image10 sort as image10 first in plain text order. Convert the data to a sortable form, for example by padding numbers with zeros, such as image02 and image10, before you sort.
Sorting is often the first step in cleaning a list. It places duplicates next to each other, which makes them easy to spot, prepares two lists for comparison and makes it easier to find gaps or odd entries. A glossary or a reading list is neater in alphabetical order. Remember that the order of accented letters depends on the language: in some languages, letters with accents sort as separate letters. If the order of the original lines has meaning, such as a chronological log, keep a copy before you sort.
Sorting arranges items in a defined order. Ascending order goes from smallest to largest or A to Z, and descending is the reverse. Lexicographic order compares characters one by one, like a dictionary. Numeric order compares values. A stable sort keeps equal items in their original order. Natural sort treats embedded numbers as values, so item 2 comes before item 10. A collation is a set of rules for ordering text in a language. A key is the value used for comparing items.
Use numeric sorting for numbers and alphabetical for words. Convert text to one case if you want a dictionary order. Dates in year-month-day form sort correctly as text. Pad numbers with zeros in names, such as 01 and 10, so that they sort as expected. Check the first and last lines after sorting, and keep the original order if it has meaning.
Sorting compares characters, not meanings. In a plain text sort the word Zebra can come before apple because capital letters sort before lowercase letters in some systems, and the number 10 can come before 2 because the character 1 comes before 2. Choose the options that match your list, such as ignoring case for names and numeric order for numbers. Accented letters and different alphabets may follow different rules in different languages. Remove empty lines before sorting, check whether you need ascending or descending order and keep a copy of the original order if it carries meaning, such as ranking or priority.
Yes. Numeric ascending mode compares parsed numeric values.
No. Empty rows are removed during sorting.
Yes. Choose Z → A.
Standard text sorting compares characters by their underlying code values, which places uppercase letters before lowercase letters; a case-insensitive sort option corrects for this.
Numeric sorting is different from alphabetical sorting; a purely alphabetical sort would order 10 before 2, so use a dedicated numeric sort option to get the mathematically correct order.