Sort Text Lines

Sort lines alphabetically or numerically.

Options
0 lines

Free online sort text lines tool

This tool takes any list of lines and puts them in the order you want — alphabetically from A to Z or Z to A, numerically by the value at the start of each line, reversed, or shuffled into a random order. It's perfect for tidying keyword lists, names, CSV columns, log entries, and any text where order matters. The result updates live as you type or paste, and nothing ever leaves your browser.

How to sort lines of text

  1. Paste or type your lines into the Input lines box.
  2. Choose a Sort order — A → Z, Z → A, numeric, reverse, or shuffle.
  3. Optionally tick Case insensitive so Apple and apple sort together.
  4. Tick Remove duplicate lines, Remove empty lines, or Trim each line to clean up as you go.
  5. Click Copy output to grab the sorted list, or Clear to start again.

Alphabetical, numeric, reverse, and random

Alphabetical sorting uses natural locale ordering, while Numeric ascending and Numeric descending read the leading number on each line so that 2 comes before 10; lines without a number drop to the bottom. Reverse flips your list exactly as it stands, and Shuffle gives a fair random order every time.

Related text tools

Want to strip repeats before sorting? Try the Remove Duplicate Lines tool. To measure the length of your list once it's sorted, head over to the Word Counter. Everything runs privately in your browser, with no sign-up and no limits.

Frequently asked questions

How do I sort lines of text alphabetically?

Paste or type your lines into the input box, then choose "A → Z" as the sort order. The lines are reordered alphabetically in the output box as you type, keeping each line on its own row. Pick "Z → A" to sort in reverse alphabetical order instead.

How does numeric sorting work?

Choose "Numeric ascending" or "Numeric descending" and the tool reads the number at the start of each line and sorts by its value, so 2 comes before 10 rather than after it. Lines that do not begin with a number are pushed to the bottom of the list.

What is the difference between Reverse and Z → A?

"Z → A" sorts your lines into reverse alphabetical order. "Reverse" simply flips the current order of the lines without sorting them, so it is handy for turning any list upside down exactly as it stands.

Can it remove duplicate or empty lines while sorting?

Yes. Tick "Remove duplicate lines" to keep only the first occurrence of each line, and "Remove empty lines" to strip out blank rows. You can also tick "Trim each line" to drop leading and trailing spaces before sorting.

Is my text sent to a server?

No. Sorting happens entirely in your browser with JavaScript. Your text is never uploaded, stored, or shared, so it is safe to sort private or sensitive lists.

What does the Shuffle option do?

Shuffle randomly reorders your lines using a Fisher–Yates shuffle, which gives every line an equal chance of landing in any position. Re-select Shuffle or edit the text to reshuffle for a fresh random order.