RH
Tool

Line Sorter

Sort text lines alphabetically

Client-side processing
0 líneas

Ordenador de Líneas

Ordena líneas de texto alfabéticamente, numéricamente, por longitud o de forma aleatoria. Soporta orden natural para nombres de archivos (file1, file2, file10 en vez de file1, file10, file2).

Info

Online Line Sorter - Sort Text Alphabetically

Available sorting modes

This tool offers several sorting modes. Alphabetical sorts by Unicode character order, with an option for case sensitivity. Numeric extracts the first number from each line and sorts by its value, which is handy for logs with timestamps or numbered lists. By length orders from shortest to longest, or the reverse. Random shuffles the lines with no predictable pattern, useful for randomising a list or creating an unbiased presentation order. Every mode supports ascending and descending direction.

Natural order versus ASCII order

Strict ASCII ordering gives you file1.txt, file10.txt, file2.txt, because it compares character by character and "1" comes before "2". Natural ordering recognises numbers as values: file1.txt, file2.txt, file10.txt. This tool offers both. Natural order is what users expect for file names, version strings such as v1, v2 and v10, and any list where embedded numbers should sort numerically. It matters especially for scripts that process files in order.

Cleanup options: duplicates and blank lines

Beyond sorting, this tool can remove duplicate lines while keeping the first occurrence, delete blank lines, and trim whitespace from each line. Those options help you clean lists pasted from several sources, prepare data for import, or normalise configuration files. Duplicate removal is case sensitive by default but can ignore case when you configure it. Combining sorting with duplicate removal gives you a clean, ordered list in a single pass.

If you work with this tool, you will probably also find these useful CSV to JSON, Word Counter, String Utilities, Text Diff.

Frequently asked questions

Why does "Zebra" come before "apple" in alphabetical order?

In ASCII order, uppercase letters (A-Z, codes 65 to 90) come before lowercase ones (a-z, codes 97 to 122), so "Z" at 90 sorts before "a" at 97. Enable the case-insensitive option so "apple" precedes "Zebra", which compares both in lowercase internally.

How do I sort by the second column of a CSV?

This tool sorts by the full content of each line. To sort by a specific column, use the Unix sort command with its -t and -k flags, or process the data in code or a spreadsheet. Another route is to convert the file to JSON, sort the array by the property you care about, and convert it back.

Is the random order genuinely random?

It uses the Fisher-Yates shuffle backed by crypto.getRandomValues() for cryptographically secure randomness, so every line has an equal chance of landing in any position. That is fine for informal draws and list randomisation. For legally significant draws, document the process.

Why do some lines look duplicated but are not removed?

The likely causes are invisible leading or trailing spaces (enable the trim option), similar-looking Unicode characters such as a non-breaking space against a normal one, or differences in capitalisation (enable case-insensitive duplicate detection). The comparison is byte exact unless you turn the normalisation options on.

© 2026
Roberto Hernando
|