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.

All processing happens on the client-side, locally in your browser. No data is uploaded.

Paste text below
Sorted Lines

Settings

How the input is converted. Each is explained below.

The type of sort you want to perform
The order of the sort you want to perform
The input separator for each item
The output separator for each item

History

  • 2018-11-12Multiple separator support
  • 2017-09-07Tool Launched

Settings explained

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.

Alphabetical
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".

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

Length: Lines are sorted on the basis of their lengths in characters. The smaller ones bubble to the top, or, with the descending sort order, sink to the bottom.

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

Reverse: Reverses the order of the lines in the original input. Sort Order is not supported in this mode.

Random: Shuffles the lines into a random order. Sort Order is not supported in this mode.

Input & Output Separator

The separator for the input text that determines each item in the list, and the one the output is written with.

New Line
Each item is separated by a newline (\r, \n or \r\n)
Comma
Each item is separated by comma (,)
Semi Colon
Each item is separated by semi-colon (;)
Tab
Each item is separated by tab (\t)
Auto
Input: separators are automatically detected from the input. Output: the same as the input separator.

Background

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.

How to sort text in various languages

LanguageSort FunctionDocumentationExample
C#System.Collections.Generic.List<T>.Sort()DocumentationExample
VB .NETSystem.Collections.Generic.List<T>.Sort()DocumentationExample
Javajava.util.Collections.sort()DocumentationExample
JavaScriptsort()Example
Pythonlist.sort()DocumentationExample
RubyArray.sort()DocumentationExample