Sort Lines

Paste a list, pick a sort direction, and the output rearranges itself on the spot. Six modes cover alphabetical ordering, length-based ranking, simple reversal, and a true random shuffle.

📋
Organize Lists
Alphabetize anything
🎲
Random Draws
Shuffle names fairly
</>
Code Cleanup
Sort imports & keys
📊
Data Sorting
Order CSV rows

All 6 Sort Modes

A B C
A → Z
Ascending alphabetical
Z Y X
Z → A
Descending alphabetical
a ab abc
Shortest
Fewest characters first
abc ab a
Longest
Most characters first
3 2 1
Reverse
Flip current order
? ? ?
Random
Fisher-Yates shuffle

How It Works

1

Add Your Lines

Paste a list, a log file, or any multi-line text into the left panel. One item per line is ideal but not required.

2

Pick a Sort Mode

Tap one of the six mode buttons. Optionally toggle case sensitivity or empty-line removal to fine-tune the result.

3

Copy the Sorted List

The right panel updates instantly. Hit Copy to grab the reordered text and drop it into a spreadsheet, document, or code file.

Best Practices

✅ Do

  • Remove empty lines first if you want a clean, compact result
  • Use Shortest/Longest to spot outlier entries in a dataset
  • Run Randomize multiple times for a fresh shuffle each click
  • Sort import statements in code to keep diffs minimal
  • Combine with Duplicate Remover to get a unique sorted list
  • Check case sensitivity when mixing acronyms and regular words

❌ Don't

  • Assume numeric lines sort numerically — they sort as text
  • Forget that "Reverse" flips order without alphabetizing
  • Leave case sensitivity on if you want "apple" near "Apple"
  • Expect multi-column sorting — only the full line is compared
  • Rely on one shuffle for a binding random draw — run it a few times
  • Ignore the line counter — it confirms empty-line removal worked

Tips by Use Case

📋

List Organization

  • Alphabetize guest lists and attendee rosters
  • Sort ingredient lists for recipe consistency
  • Order bibliography entries before submitting
  • Clean up brainstorm dumps into structured lists
🎲

Random Selection

  • Shuffle a class roster for fair presentation order
  • Randomize raffle entries before picking a winner
  • Create random team assignments from a name list
  • Shuffle flashcards for varied study sessions
</>

Code & Config

  • Sort Python or JS import blocks alphabetically
  • Order CSS properties within each rule
  • Alphabetize .env keys for quick scanning
  • Sort package.json dependency lists
📊

Data Analysis

  • Sort log entries to group similar messages
  • Order CSV rows before comparing datasets
  • Use Longest mode to find overly long entries
  • Reverse-sort timestamps to see newest first

Frequently Asked Questions

How does the alphabetical sort handle uppercase and lowercase?
By default the sort is case-insensitive — "apple" and "Apple" are treated as equal weight. Enable the "Case sensitive" checkbox and uppercase letters will sort before their lowercase counterparts because capital letters have lower Unicode code points.
What algorithm powers the Randomize mode?
It uses the Fisher-Yates (Knuth) shuffle, which walks the array backwards and swaps each element with a randomly chosen earlier element. Every possible permutation has an equal probability, so the output is uniformly random.
What is the difference between Reverse and Z-A?
Z-A sorts all lines into descending alphabetical order regardless of their original position. Reverse simply flips the current line order top-to-bottom without any alphabetical comparison — the last line becomes the first.
Can I sort numbers correctly?
The tool sorts lines as text, so "9" sorts after "10" alphabetically. If you need numeric sorting, pad single-digit numbers with a leading zero (01, 02 ... 10) or use a spreadsheet for numeric-aware ordering.
Is it possible to sort by a second word or column?
Not directly — the tool compares entire lines. As a workaround, rearrange your data so the column you want to sort by comes first, sort, then rearrange back. For complex column sorting, a spreadsheet is the better tool.
Does this work with non-English alphabets?
Yes. The sort uses JavaScript's localeCompare, which respects locale-aware ordering for accented characters, Cyrillic, CJK, and other scripts. Results follow the browser's default locale rules.
What happens to empty lines?
If "Remove empty lines" is checked (it is by default), blank lines are stripped before sorting. Uncheck it to keep them — they will sort to the top in A-Z mode since an empty string comes before any character.
Is there a limit on how many lines I can sort?
There is no hard cap. The tool runs in your browser, so performance depends on your device. Lists of several thousand lines sort in well under a second on modern hardware.

Got a List That Needs Order?

Paste your lines into the editor, tap a sort mode, and the output rearranges itself before you finish reading this sentence. Free, instant, and private.