Line Sorter & Text Cleaner

Sort, number, shuffle and clean up lines of text.

Sort

Clean

Everyday line operations

Working with lists in a plain text editor is awkward. Sorting requires a spreadsheet, numbering requires manual typing, and cleaning up inconsistent whitespace is tedious. This tool collects the operations people most often need into a single page.

Sorting modes

Alphabetical sorting uses locale-aware comparison, which orders accented characters sensibly rather than dumping them after Z as a naive byte comparison would.

Numeric sorting exists because alphabetical sorting handles numbers badly. Sorted as text, 10 comes before 9, because comparison proceeds character by character and the character 1 precedes 9. Numeric mode parses each line as a number and orders accordingly, which is what you want for prices, quantities or IDs.

Sorting by length is useful for spotting outliers — an unusually short line in a data export is often a truncation error, and an unusually long one often contains a stray delimiter.

Shuffling uses the Fisher-Yates algorithm, which produces a genuinely uniform permutation. The naive approach of sorting by a random comparator does not, and produces subtly biased orderings.

Cleaning operations

Trimming removes leading and trailing whitespace, which is the fix for the most common invisible data problem. Entries copied from PDFs, web pages or spreadsheets routinely carry trailing spaces that break comparisons, deduplication and lookups while remaining completely invisible.

Collapsing multiple spaces to one tidies text pasted from justified layouts. Converting tabs to spaces matters when moving content between editors with different tab settings, where the same file can appear completely differently indented.

Numbering

Adding numbering pads the numbers so they align, which matters for readability in lists longer than nine items. Stripping numbering does the reverse and handles the common formats — a number followed by a dot, a bracket or a parenthesis. This is the fastest way to convert a numbered list copied from a document back into clean data.

Where these get used

Tidying lists of URLs before building a sitemap. Sorting keyword exports. Cleaning data pasted from a PDF before importing to a spreadsheet. Randomising a list for fair ordering. Preparing configuration files with consistent formatting. Converting a numbered document list into plain values.

Processed locally

Everything runs in your browser, so nothing you paste is transmitted or stored.

Frequently Asked Questions

Why does numeric sorting exist separately?

Alphabetical sorting compares character by character, so 10 sorts before 9. Numeric mode parses each line as a number and orders correctly.

What does trimming actually fix?

Invisible leading and trailing spaces, which break deduplication, comparisons and lookups while looking completely normal on screen.

Is the shuffle genuinely random?

Yes. It uses the Fisher-Yates algorithm, which produces a uniform permutation. Sorting by a random comparator does not.

Can I chain operations?

Yes. Use the Result as Input button to feed the output back in and apply another operation.

Is there a size limit?

No imposed limit. Lists of tens of thousands of lines process near-instantly.