Sort Text Online

Text Sorter is used to sort lines of text using techniques like alphabetical, natural, length, random, etc. Sort order - ascending/descending can be specified when applicable. You can also reverse the lines of text purely based on the original input.

Input: Paste text below

Settings

Background Information

We all use text files everyday. Be it a list of file paths, names of people or things to do. There is often a need to quickly manipulate lines of text in a particular form. Sorting is one such operation. Read more at wikipedia.

Settings Explained
• 1. Sort Type

This is the main setting as it governs the sorting logic/strategy. The following strategies are available:-

Alphabetical

This is the default sorting order which utilizes a case insensitive & culture neutral comparison between items. Numbers are treated as normal ASCII characters. For more information, checkout the wikipedia article on alphabetical order.

007, James Bond
09, John Doe
1, Jane Doe
Natural

This is similar to alphabetical sorting, but treats numbers differently. Consecutive numbers are grouped together and treated as a single character. For example, "1, Jane Doe" will appear before "007, James Bond". For more information, checkout the wikipedia article on natural sort order.

1, Jane Doe
007, James Bond
09, John Doe
Length

In this type of sorting, lines are sorted on the basis of their lengths in characters. So, you can make the smaller ones bubble to the top or use the descending sort order to make them sink to the bottom with the larger ones taking the top spots.

1, Jane Doe
09, John Doe
007, James Bond
Reverse

This is useful mainly if you want to reverse the order of the lines in the original input. Sort Order is not supported in this mode.

Original
09, John Doe
1, Jane Doe
007, James Bond
Sorted
007, James Bond
1, Jane Doe
09, John Doe
Random

This sort type randomizes the lines. Sort Order is not supported in this mode.

• 2. Sort Order

Some sort types support ascending & descending modes. Setting descending order reverses the order of the items while still applying the sorting logic.
Random & Reverse sort types do not support sort order.

• 3. Input Separator

The separator for the input text that determines each item in the list

New Line

Each item is separated by a newline (\r \n or \r\n)

Item1
Item2
Item3
Comma

Each item is separated by comma (,)

Item1,Item2,Item3
Semi Colon

Each item is separated by semi-colon (;)

Item1;Item2;Item3
Tab

Each item is separated by tab (\t)

Item1	Item2	Item3
Auto

Separators are automatically detected from the input

• 4. Output Separator

The separator for the output text that determines each item in the list

New Line

Each item is separated by a newline (\r \n or \r\n)

Item1
Item2
Item3
Comma

Each item is separated by comma (,)

Item1,Item2,Item3
Semi Colon

Each item is separated by semi-colon (;)

Item1;Item2;Item3
Tab

Each item is separated by tab (\t)

Item1	Item2	Item3
Auto

Separator is the same as the input separator (either detected or explicitly specified)

How to sort text in various languages

• Language: C#
• Sort Function: System.Collections.Generic.List<T>.Sort()
• Documentation: Documentation
• Example: Example
• Language: VB .NET
• Sort Function: System.Collections.Generic.List<T>.Sort()
• Documentation: Documentation
• Example: Example
• Language: Java
• Sort Function: java.util.Collections.sort()
• Documentation: Documentation
• Example: Example
• Language: JavaScript
• Sort Function: sort()
• Documentation:
• Example: Example
• Language: Python
• Sort Function: list.sort()
• Documentation: Documentation
• Example: Example