TEXT TOOLS

Text Sorter Online

Sort complete lines alphabetically, numerically or by length. Use natural number ordering, reverse the original list or shuffle it, while keeping your source text unchanged.

✓ Free to use ✓ No signup ✓ Sorting in your browser

Maximum 500,000 UTF-16 code units. No input is silently truncated. Duplicate entries are retained.

Retained lines keep their spelling and spacing. Output uses LF line endings. Numeric mode requires one complete number per line.

Loading the sorter…

0Input lines
0Output lines
0Blank lines removed
0Result code points

A final line ending terminates the last line rather than adding a counted line. It is retained if any lines remain. Equal sorting keys keep their source order in alphabetical, numeric and length modes.

How to sort text lines

1. Paste your list

Place one entry per line in the original-text box.

2. Select an order

Choose alphabetical, numeric, length, reverse or shuffle options.

3. Review and export

Click Sort lines, inspect the result, then copy or download it.

Choose the right sorting method

Alphabetical and natural sorting

Alphabetical sorting uses your browser’s language-sensitive comparison. Choose English, French, Spanish or Arabic to select the comparison locale. Ignoring case keeps accent differences significant while treating case variants as equal where the collator does so. Punctuation is not explicitly ignored.

Natural number ordering compares digit sequences inside labels as numbers, so file2 comes before file10. Turn it off for lexical ordering. Natural sorting is not a decimal, date or software-version parser. Collation details can vary with browser Unicode data.

Numeric sorting for complete numbers

Numeric mode requires every retained line’s sorting key to be a complete finite number. It accepts ASCII digits, an optional sign, a decimal point and scientific notation, such as -2.5, .75 or 1e3. Thousands separators, decimal commas, currencies, hexadecimal and localized numeral characters are not accepted.

Numeric comparisons use JavaScript floating-point numbers, not arbitrary-precision arithmetic. Very large or precise values can round to equal numbers or underflow. Use suitable numeric software when exact high-precision ordering is required. Invalid lines stop the operation rather than being silently sorted as zero.

Sort by length

Length mode compares the number of Unicode code points in each sorting key. With outer-whitespace trimming enabled, those outer spaces do not contribute to the length key, although they remain in the output. Emoji sequences and combined accents may contain multiple code points.

Reverse or shuffle the original

Reverse flips the original line sequence; it does not alphabetize it first. Shuffle uses a Fisher–Yates shuffle with Math.random(). It is intended for ordinary list rearrangement, not security-sensitive randomness or certified draws. Repeated shuffles can produce the same order, especially for short lists.

Every run starts from the original input. To reorder a previous result again, copy it into the original box yourself.

Preserve line contents

Sorting-key trimming affects comparison only; it does not rewrite retained lines. Duplicates stay in the list. The optional blank-line filter removes empty or JavaScript-whitespace-only lines before sorting. Numeric mode rejects retained blank lines, so enable the filter if your numeric list includes them.

The tool sorts complete lines, not CSV columns or multiline records. It recognizes CRLF, CR and Unicode line separators and generates LF output. It is not a byte-preserving file editor.

Use Remove Duplicate Lines to deduplicate a list, or Text Compare to inspect changes.

Privacy and local processing

This tool’s code sorts your list locally in your browser. It does not send the input to an API or save it in browser storage. Copying uses the clipboard when requested, and TXT downloads are generated locally in UTF-8.

Your browser, extensions and other scripts installed on this website have their own behavior, which this tool does not control.

Frequently asked questions

Does the sorter remove duplicate lines?

No. Duplicate lines remain. Use the separate Remove Duplicate Lines tool when you want only one occurrence of each entry.

Why does file2 come before file10?

Natural number ordering is enabled by default in alphabetical mode. It treats digit sequences as numbers. Disable it for lexical ordering.

Does numeric mode accept lines such as “12 items”?

No. Each retained sorting key must be a complete number. For mixed labels and numbers, use alphabetical mode with natural number ordering instead.

Does ignoring outer whitespace trim the output?

No. It changes the sorting key only. Retained lines keep their original content and surrounding spacing.

What happens when two sorting keys compare equally?

Their original relative order is retained in alphabetical, numeric and length modes, including descending modes. Reverse and shuffle deliberately reorder positions instead.

Does changing an option update the result automatically?

No. It clears the previous result to prevent stale output. Click Sort lines again to apply the new settings.