Skip to content

Menu

Line Shuffler

Randomly shuffle the order of lines in text.

Runs entirely in your browserText & DiffFree, no sign-up
Loading tool

01What is Line Shuffler?

Line Shuffler takes a block of text and hands it back with the lines in a random order. That sounds trivial, but a lot of homemade shuffles are quietly unfair. The classic mistake is sorting by Math.random(), which favours some orders over others. We avoided that. Here is how it works. When you click Shuffle Lines, the tool splits your input on line breaks, accepting both Unix newlines and Windows CRLF. Then it runs a Fisher-Yates shuffle, the algorithm Knuth describes in The Art of Computer Programming. It walks the list from the last line backwards and swaps each line with a randomly chosen line at or before it. Given a fair random source, every possible ordering comes out equally often. The random source is the browser's crypto.getRandomValues, defined in the W3C Web Cryptography API. It is the same generator browsers use for keys and tokens. Each pick also uses rejection sampling, which throws away the few raw values that would make low positions slightly more likely. In our own test, shuffling a, b and c sixty thousand times gave each of the six orders close to ten thousand hits. A quick example. Paste Alice, Bob, Carol and Dan on four lines and click the button. One run gave Carol, Dan, Alice, Bob. Click again and you get a fresh draw, such as Dan, Alice, Bob, Carol. The counter next to the button tells you how many lines it found. Nothing about your lines changes except their position. Blank lines, duplicates, leading spaces and odd characters all survive exactly as typed. The output always uses plain newlines, even if you pasted CRLF text. Now the limits. There is no seed, so you cannot replay a past shuffle. Copy any result you want to keep before clicking again. A trailing newline at the end of your paste becomes an empty line, and it gets shuffled in like any other. The button stays disabled until the input has some visible text. For a raffle or draw with money or legal stakes, a browser shuffle with no audit trail is not enough on its own. The shuffling happens in the page's own JavaScript. Your list is never uploaded, so pasting a list of names or email addresses is fine.

Teachers shuffling quiz questions, team leads choosing a fair standup order, and QA engineers checking that code does not rely on input order. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Line Shuffler

  1. Paste your list into the Input Lines box, one item per line
  2. Check the line counter next to the button to confirm the tool sees the right number of items
  3. Click Shuffle Lines
  4. Click Shuffle Lines again whenever you want a different order
  5. Use the copy icon above Shuffled Output to copy the result, or Reset to clear both boxes

03Worked examples

Input: Alice Bob Carol Dan
Result: Carol Dan Alice Bob
One real run. Each click draws a new order, so your result will differ.
Input: Same four names, clicked again
Result: Dan Alice Bob Carol
A second run of the same input gave a different permutation.
Input: Alice, Bob, Carol, Dan pasted with Windows CRLF line endings
Result: Bob Carol Alice Dan
CRLF input is split correctly and the output uses plain newlines.
Input: a b (trailing newline)
Result: a b (empty line)
The trailing newline became a third, empty line that took part in the shuffle. Here it happened to land last.
Input: only line
Result: only line
A single line has only one possible order.
Input: a, b, c shuffled 60,000 times
Result: bac 9995, cab 9968, bca 10004, acb 10001, abc 10038, cba 9994
Our test run of the tool's shuffle function. All six orders appear about equally often.

04Common use cases

  • Randomising the order of quiz questions or flashcards so students cannot memorise the sequence
  • Picking a speaking order for a team standup or demo day from a list of names
  • Shuffling rows of test fixtures to catch code that silently depends on input order
  • Drawing a winner from a list of giveaway entries by taking the first line of the output
  • Splitting a class or team into random groups by shuffling once and taking blocks of N lines
  • Mixing up survey answer options before pasting them into a form builder that has no shuffle feature

05Tips

  • Delete the trailing newline at the end of a paste, or an empty line will join the draw and might land first.
  • Duplicates count as separate entries. If one person appears twice, they get two chances, so dedupe first with the Line Sorter.
  • Fisher-Yates touches each line once, so even very long lists shuffle without a noticeable wait.
  • Need a repeatable order for a test suite? Shuffle once here and commit the result, since the tool cannot reproduce a run from a seed.

06Related concepts

Fisher-Yates algorithm, Random permutation, CSPRNG, Rejection sampling.

Frequently Asked Questions

What is Line Shuffler?

Line Shuffler is a free, browser-based developer tool on AIDToolStack. Randomly shuffle the order of lines in text. It requires no installation or sign-up and works entirely in your browser.

Is Line Shuffler free to use?

Yes. No sign-up, no fees and no usage cap.

Does Line Shuffler store my data?

No. It runs in your browser; nothing is uploaded.

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe