🔀 Shuffle Lines

Randomize and shuffle the order of text lines instantly. Perfect for creating random lists, randomizing surveys, shuffling data entries, and mixing up line sequences. Uses Fisher-Yates algorithm for uniform distribution.

📌 Shuffled Output:
Enter text and click "Shuffle Lines" to randomize the order...
0
Total Lines
0
Blank Lines
0
Content Lines
💡 How it works:
  • Paste your text with one item per line
  • Click "Shuffle Lines" to randomize the order
  • Uses Fisher-Yates shuffling algorithm for fair randomization
  • Blank lines are preserved in their randomized positions
  • Each shuffle produces a different random order
  • Statistics show total, blank, and content lines

📝 Examples:

Input (Original Order):
apple banana cherry date elderberry
Output (Shuffled - Example 1):
cherry elderberry apple date banana
Output (Shuffled - Example 2, Different Random Order):
banana date cherry apple elderberry
Input (With Blank Lines):
Item 1 Item 2 Item 3
Output (Shuffled - Blank Lines Preserved):
Item 3 Item 1 Item 2
Statistics (Example):
Total Lines: 5
Blank Lines: 0
Content Lines: 5
📚 Use Cases:
  • Randomize survey response options
  • Shuffle playlist or song lists
  • Mix up test questions or exam items
  • Randomize game participant lists
  • Create random drawing order for contests
  • Shuffle TODO lists or task priorities
  • Generate random data order for analysis
â„šī¸ Note: This tool uses the Fisher-Yates shuffling algorithm for uniform randomization. Each time you shuffle, you get a different random order. Blank lines are preserved in their randomized positions.

Why the shuffle runs backwards

Fisher-Yates starts at the last line and works up, swapping each line with one drawn from the part of the list that has not been placed yet:

for i = n-1 down to 1:
    j = floor(Math.random() * (i + 1))     // 0 .. i inclusive
    swap lines[i] and lines[j]

Because the draw range shrinks by one each step, every one of the n! possible orderings is equally likely. The tempting one-liner - sort(() => Math.random() - 0.5) - is not equivalent: it feeds an inconsistent comparator to a sort routine and leaves items near where they started.

How random the randomness is

Fine for seating plans, quiz questions and playlists. For a prize draw with real money at stake, use a method you can show your entrants - random.org publishes a signed record of each draw.

Frequently asked questions

Could the same order come up twice?

Easily, on a short list. Five lines have only 120 possible orders, so repeats are common. Twenty lines have 2.4 quintillion orderings, so a repeat there will never happen.

How do I shuffle rows in Excel instead?

Put =RAND() in a helper column, fill it down, then sort by that column and delete it. Pasting a column here is quicker and does not leave volatile formulas recalculating in the sheet.

Does shuffling change my text in any way?

No. Lines are reordered, never edited - spacing, capitalisation and duplicates all survive intact, and the line count is identical before and after.