🇬🇧EN

Sort Lines

Sort lines alphabetically, numerically, by length or randomly — in your browser.

✨ What do you want to try next?

You've finished this tool — here are a few you might find useful.

Explore 100+ free toolsPDF, Image, Text, Convert, Calculate and more — all free.View all tools →

About Sort Lines

This reorders the lines of a list however you need — alphabetically, in reverse, by the number each line starts with, by length, or shuffled into a random order. It's the fast way to alphabetise a list of names or terms, order values numerically, arrange lines shortest-to-longest, or randomise entries for a draw or a randomised test order. An optional de-duplicate step removes repeats at the same time.

How it works — the sort modes

  • A→Z / Z→A — compares lines as text and orders them ascending or descending. With 'ignore case' on, capitalisation doesn't affect the order.
  • Numeric — reads the number at the start of each line and sorts by its value, so 2 comes before 10 (unlike text order).
  • By length — orders lines from shortest to longest by character count.
  • Shuffle — randomly reorders the lines using the Fisher–Yates algorithm, seeded by the browser's cryptographic random generator with rejection sampling, so the shuffle is genuinely unbiased.

With de-duplicate enabled, repeated lines are removed first (respecting the ignore-case setting).

Assumptions and behaviour

  • Alphabetical sorting compares by character-code order, not language-aware collation. By default uppercase letters sort before lowercase (so Zebra comes before apple); turn on 'ignore case' for a more intuitive A–Z.
  • Numeric mode reads only the leading number of each line; a line with no number at the start is treated as 0.
  • Shuffle uses cryptographic randomness with rejection sampling, giving every arrangement an equal chance.

Limitations

  • Alphabetical order isn't locale-aware. Accented letters and non-Latin scripts sort by their underlying code points, which may not match dictionary order for your language.
  • Numeric sort keys on the first number only — 12 apples sorts by 12, but apples 12 sorts as 0. Mixed text-and-number lines won't sort the way a natural ("human") sort would.
  • 'By length' counts UTF-16 code units, so lines heavy in emoji or non-Latin characters may measure longer than they look.
  • It sorts whole lines; it can't sort by a column within each line.

Privacy

Sorting happens entirely in your browser. Your list is never uploaded or stored.

Frequently asked questions

Is this line sorter free?

Yes — free, no sign-up, no limits, runs in your browser.

Why does 'apple' sort after 'Zebra'?

Alphabetical mode compares by character code, where uppercase letters come before lowercase. Turn on 'ignore case' for a natural A–Z order.

Does numeric sort understand 2 vs 10 correctly?

Yes. Numeric mode reads the number at the start of each line and sorts by value, so 2 comes before 10 — but it only uses the leading number on each line.

Is the shuffle really random?

Yes. It uses the Fisher–Yates shuffle with the browser's cryptographic random generator and rejection sampling, so every ordering is equally likely with no bias.

Can it remove duplicates while sorting?

Yes — enable de-duplicate and repeated lines are removed first, respecting the ignore-case option.

Does it sort accented or non-Latin text correctly?

It sorts by character code, not locale rules, so accented and non-Latin lines may not follow your language's dictionary order.

Is my data uploaded?

No. Everything runs locally in your browser; nothing is sent or stored.

Lakshay Kumar

Written by Lakshay Kumar(TechLakshay)

A QA Automation Engineer by trade, Lakshay's real passion is untangling complex problems into simple, working solutions — which is exactly why FreeMyTask exists. On Instagram, he channels that same instinct into helping 26,000+ content creators with SEO education, motivation, and hands-on query solving.

Last updated: August 22, 2026
🎁