DevTools Logo

Text Shuffler

Text Shuffler

Randomize lines, words, or characters with unbiased in-browser randomness and optional seeds.

Runs in your browser
Reorder whole lines, keeping blank separators in place.
Try an example

Text to shuffle

Shuffled

Type text to shuffle it

Results update as you type. Nothing leaves your browser.

Details

Naive shuffle snippets such as sort(() => Math.random() - 0.5) do not produce uniformly random orders. The Text Shuffler uses Fisher–Yates with rejection-sampled 32-bit draws from the browser's crypto randomness, so every permutation is equally likely. If you need the exact same order twice, switch on a text seed: the same seed and input always produce byte-identical output, which makes it easy to share a quiz order with a colleague. Choose what moves: whole lines, the words inside each line, or the characters inside each word. Blank lines can act as fixed separators, so the chunks between them exchange places instead of being broken apart. Optional preparation steps trim lines, remove duplicates, and strip existing numbering before the shuffle; numbering can then be applied to the result. Text up to 5 MB is accepted, and everything stays in this tab — nothing is uploaded.

More examples

Randomize quiz questions

Q1: What is Fisher–Yates?
Q2: Which API supplies random bytes?
Q3: What is FNV-1a?

→ Shuffle mode: Lines · Keep blank lines on

Every question moves as a unit, so no prompt is torn apart by the shuffle.

Reproducible with a seed

Seed: class-a
Input:  alpha / beta / gamma / delta
Output: gamma / alpha / delta / beta (same every time)

Share the seed with someone else and they get the identical order on the same input.

Shuffle words, keep spacing

  the quick brown  fox	jumps  

→   brown the  quick	fox  jumps  (spaces and tabs stay in their slots)

Word mode permutes words among word slots and leaves every whitespace run untouched.

Clean numbered duplicates

1. apple
2. apple
3. banana

→ Strip numbering + Dedupe + Number output
→ 1. banana
→ 2. apple

Numbers are removed before dedupe, so numbered copies of the same line collapse correctly.

    Examples

    Randomize a quiz

    Input
    Question one
    Question two
    Question three
    Question four
    Output
    Question three
    Question one
    Question four
    Question two

    One unbiased Fisher–Yates permutation of whole lines; run it again for a fresh order.

    Reproducible seeded shuffle

    Input
    mode: lines · seed: class-a
    alpha
    beta
    gamma
    delta
    Output
    gamma
    alpha
    delta
    beta

    The same seed and input always produce the same permutation, even across devices.

    Chunks around blank separators

    Input
    intro one
    intro two
    
    part a
    part b
    
    closing
    Output
    part a
    part b
    
    closing
    
    intro one
    intro two

    The blank lines stay in place as separators while the chunks between them exchange order.

    Use cases

    Quiz and exam ordering

    Paste a question bank, shuffle lines, and give every student a different order. Use a seed when you need to reproduce one specific version.

    Name draws and assignments

    Randomize a list of names or topics, then copy or download the result. Crypto randomness keeps the draw fair.

    Language exercises

    Word mode scrambles words inside each line while preserving indentation, tabs, and double spaces, so worksheets keep their layout.

    Test fixture generation

    Dedupe and strip numbering before shuffling to generate fresh, ordered fixtures from an existing numbered list.

    Common mistakes

    Mistake:Using sort(() => Math.random() - 0.5) to shuffle a list

    Fix:That comparator is biased and can leave items in place. This tool uses Fisher–Yates with rejection-sampled crypto draws so every order is equally likely.

    Mistake:Expecting the same seeded order after changing the text

    Fix:A seed fixes the permutation for one exact input. Editing, trimming, deduping, or stripping numbering changes the items being shuffled and therefore the result.

    Mistake:Running character mode on sentences with punctuation or emoji

    Fix:Character mode shuffles every code point inside a word, including marks and emoji. Use word mode when you need words or typographic details to stay intact.

    Frequently asked questions

    Is the shuffle truly random?

    In crypto mode every index comes from crypto.getRandomValues with rejection sampling, which removes the modulo bias of a plain remainder operation. Fisher–Yates then guarantees a uniformly random permutation. If the browser has no crypto source, the tool warns you and uses a predictable fallback instead of silently pretending it is random.

    What does a seed do, and what happens if I leave it empty?

    A seed converts your text into an FNV-1a hash that drives a mulberry32 generator, so the same seed and the same input produce the identical order every time. An empty seed is still a valid deterministic seed; the tool shows a warning that this implicit seed is being used so you are not misled into thinking the result is fresh randomness.

    Can I shuffle words within each line or characters within words?

    Yes. Word mode moves words among the word slots in each line while leaving every run of spaces and tabs in its original position. Character mode shuffles the Unicode code points inside each word and also leaves whitespace untouched; punctuation is treated as a character, so use word mode if that matters. Both modes use Array.from so emoji surrogate pairs are never broken apart.

    How are duplicate lines and numbering handled?

    Turn on Dedupe to keep only the first copy of each line. Strip numbering removes leading markers like '1. ' or '2) ' before dedupe, which means '1. apple' and '2. apple' collapse correctly. Number output re-applies clean '1. ', '2. ' numbering after the shuffle, so re-shuffling a numbered list never stacks old numbers on top of new ones.

    Does my text leave the browser?

    Nothing leaves your browser. All shuffling, hashing, and statistics run locally in this tab; there is no upload and no server-side copy. The three most recent outputs are kept only in memory for restore chips and disappear when you reload.

    References & standards