Sort Text Lines
Sort lines of text alphabetically, numerically, by length, or randomly — with dedupe and empty-line removal.
About the Sort Text Lines
Sort Text Lines takes any block of text and reorders it line by line, exactly the way you need. Paste a list — names, URLs, log entries, CSV rows, to-do items, keywords — and instantly sort them alphabetically (A–Z or Z–A), numerically, by line length, in reverse, or in a random shuffle. Along the way you can fold away case differences, drop duplicate lines, and strip out blank lines, so a messy paste becomes a clean, ordered list in a single step.
Sorting lists by hand is tedious and easy to get wrong, especially once a list grows past a screenful. Spreadsheets can sort, but opening one just to alphabetize twenty lines is overkill, and they often mangle formatting or reinterpret your text as dates or numbers. This tool keeps things simple: it treats each line as plain text, applies one clear rule, and shows the result the moment you change an option. Everything runs locally in your browser — your text is never uploaded, stored, or sent anywhere — so it is safe to use with private lists, internal data, or anything you would rather not paste into a website.
How to use
- Paste your text into the top box, with one item on each line.
- Pick an order: A → Z, Z → A, Numeric ascending or descending, By length, Reverse, or Shuffle. The result updates instantly.
- Toggle the options you want — case-insensitive matching, remove duplicate lines, and remove empty lines — to refine the output.
- Copy the result with one click, or Clear to start fresh with new text.
A few notes on the options. Case-insensitive treats "Apple" and "apple" as the same for sorting and for detecting duplicates, so mixed-case lists group naturally. Numeric sorting reads the number at the start of each line (using standard number parsing), which is handy for lists like "10 apples" and "2 pears" that alphabetical sorting would order incorrectly; lines without a leading number are pushed to the end. By length orders short lines first and breaks ties alphabetically. Shuffle produces a fresh random order each time you click it, which is useful for picking a random winner or randomizing a playlist.
Frequently asked questions
Does this tool upload or store my text?
No. All sorting happens entirely in your browser using client-side JavaScript. Your text never leaves your device — nothing is uploaded to a server, saved, or shared. That makes it safe for confidential lists, internal data, or personal notes.
How does numeric sorting decide the order?
Numeric sorting reads the number at the beginning of each line with standard parsing, so "12" comes after "2" instead of before it (as it would alphabetically). Lines that do not start with a number are treated as having no value and are moved to the end of the list, keeping your real numbers cleanly ordered.
What does the case-insensitive option actually change?
When enabled, uppercase and lowercase letters are treated as equal. This affects two things: the sort order groups "Zebra" and "zebra" together instead of separating capitals from lowercase, and duplicate detection considers "Email" and "email" to be the same line. Turn it off if capitalization matters and you want an exact, case-sensitive comparison.
Will removing duplicates keep the first or last copy?
It keeps the first occurrence of each line and removes every later repeat. Whitespace matters unless you also account for it — two lines are only "the same" when their text matches (case aside, if case-insensitive is on). Removing empty lines is separate and simply deletes lines that contain nothing but spaces or are blank.
Can I sort a very long list?
Yes. There is no fixed line limit, and because the work runs locally the tool handles thousands of lines quickly. Extremely large pastes depend on your device's memory, but ordinary lists — even long ones — sort almost instantly.
Why use this instead of a spreadsheet?
It is faster for quick jobs and preserves your text as-is. Spreadsheets can auto-convert entries into dates, numbers, or formulas, and they require opening a file and selecting a column. This tool takes a raw paste, applies one clear rule, and gives you copy-ready output without touching your formatting or your privacy.