Shuffle Lines

Lines shuffled—

How Shuffle Lines is calculated: Lines are reordered with a Fisher-Yates shuffle driven by Math.random, seeded from the current time, so every press gives a fresh order.

What is a shuffle lines tool?

A shuffle lines tool takes a list, one item per line, and puts the lines in a random order. Paste in five names, ten quiz questions, or a hundred raffle entries, press the button, and the lines come back mixed up. The default list on this page has five fruit names — Apple, Banana, Cherry, Date, Elderberry — and one press gives them back in a new order.

The need comes up whenever order has to be fair. A teacher shuffling exam questions so no two pupils get the same order. A team lead drawing names for a secret gift exchange. A quiz master mixing up answer options. A giveaway host picking winners from a list of entries. In each case, a human shuffle is biased — we favour the top of the list and the names we like — and a random shuffle is not.

This tool shuffles in your browser and nothing leaves your device. There is no account, no upload, and no list stored anywhere. Paste your lines, press Shuffle Lines, and copy the result. Press it again for a different order. The count shown above the output is the number of lines shuffled, so you can check at a glance that nothing was lost.

How shuffling works: the Fisher-Yates method

The shuffle uses the Fisher-Yates method, the standard way to randomise a list. It walks through the list from the last line to the first, and at each step swaps the current line with a randomly chosen earlier line. After one pass, every possible order is equally likely. A list of 5 lines has 120 possible orders; a list of 10 has 3,628,800.

Randomness comes from Math.random, seeded by the current time through Date.now, so each press starts from a different point. The button exists for a reason: shuffling is an action you repeat, not a live calculation. Every press is a fresh shuffle, and pressing twice in a row gives two different orders almost every time.

The tool never adds, removes, or changes a line. It only changes the order. Blank lines are treated as lines too, so if your list has an empty line in the middle, it stays in the list and lands somewhere in the shuffled result. If you want a clean list, remove blank lines before you shuffle.

Your list: one item per line

The one rule is simple: one item per line. Each line is one entry, whatever it is — a name, a question, a number, a word. The tool splits your text on line breaks, so a list separated by commas on a single line will be treated as one line, not many. If your list uses commas, replace them with line breaks first.

The default list shows the shape clearly: Apple on line 1, Banana on line 2, Cherry on line 3, Date on line 4, Elderberry on line 5. Five lines in, five lines out, in a new order. A list of 100 lines works the same way, and a list of 1,000 lines works too — the shuffle takes a fraction of a second at any size a person would paste.

Long lines are fine, and so are lines with numbers, punctuation, or other languages. The shuffle does not read the words; it only moves the lines. A word counter can tell you how long the list is before you shuffle it, and a lorem ipsum generator can make filler lines to test the shuffle with.

A worked example: shuffling five names

Take the default list: Apple, Banana, Cherry, Date, Elderberry. Press Shuffle Lines once and the five lines come back in a random order — perhaps Cherry, Apple, Elderberry, Banana, Date. Press it again and the order changes — perhaps Date, Banana, Apple, Cherry, Elderberry. The count stays 5 both times, because the same five lines are there.

Now try a real job. You have 20 pupils and you want a random order to present in. Paste the 20 names, one per line, press the button, and the first name in the output presents first. The count reads 20, so you know no name was dropped. If two names look too close together, press again — a new order costs one click.

A second real job: a raffle with 50 entries. Paste the 50 entries, shuffle once, and the first three lines are your winners. Because every order is equally likely, every entry has the same chance of landing on top. A random number generator can pick the winning positions instead — shuffle first, then draw numbers — and the two tools agree, because both use the same kind of randomness.

Who shuffles lines, and why

Teachers are the biggest users. Shuffling questions stops pupils copying from the neighbour, shuffling names makes cold-calling fair, and shuffling teams stops the same friends always working together. A teacher who shuffles by hand wastes ten minutes and still ends up with a biased order; a teacher who pastes and presses is done in seconds.

Quiz and game hosts are the second group. A pub quiz with the same question order every week gets stale; a shuffled order keeps it fresh. A playlist maker shuffles song titles, a fantasy league shuffles draft order, and a Secret Santa organiser shuffles names so no one draws themselves twice in a row.

Giveaway hosts and researchers are the third group. A giveaway with 200 entries needs a fair draw, and a shuffled list gives one. A researcher shuffling survey responses removes order bias from the data. The tool handles all three uses the same way — paste, press, copy — which covers most of what anyone needs.

Shuffle lines vs picking a random number

Shuffling a list and picking a random number are cousins, but they answer different questions. A shuffle reorders everything; a random number picks one thing. If you need one winner from 50 entries, either works — shuffle and take the top line, or pick a random number from 1 to 50. If you need a full order, only a shuffle does the job.

The same text-tools family on this site does both jobs. A random number generator picks numbers the same way this tool picks line positions — the maths is identical, only the output changes. A lorem ipsum generator makes filler lines to test with, and a word counter tells you how many lines and words your list holds.

A spreadsheet can shuffle too, with a random column and a sort, but that takes five steps and a formula. This tool takes one press. The spreadsheet wins when the list lives in a sheet already; this tool wins when the list lives in your head, a chat message, or a document you can copy from.

Common shuffling mistakes

The most common mistake is shuffling a list that is not one item per line. A list like Apple, Banana, Cherry on one line is a single line to this tool, so it cannot be shuffled. Split it first — one item, one line — and the shuffle works. The same trap catches lists separated by spaces or semicolons.

Second: forgetting the blank lines. An empty line in the middle of your list is a line, and it shuffles like any other. If your list ends with a blank line, the output may start or end with a blank line. Trim the list before you paste it, or delete the blank line from the result.

Third: shuffling once and assuming the order is fixed. Every press re-shuffles, so if you press the button again after copying, the screen shows a new order that is not the one you copied. Copy first, then press again if you want another order. And fourth: using a shuffle to pick a winner and then re-shuffling because you did not like the result — that is not random any more, it is choosing.

Fifth: trusting a human shuffle. People shuffle by swapping a few items, which leaves most of the list in place. A real shuffle moves everything. If your shuffled list looks almost the same as the original, press again — with 5 lines, 1 in 120 shuffles comes back in the original order by pure chance.

How to use this shuffle lines tool

Using this tool is simple. Paste your list into the box, one item per line. The default five fruit names are there to try it with — replace them with your own list. Press Shuffle Lines and the shuffled list appears in the output box, with the line count shown above it.

To copy the result, use the Copy button next to the output box. To shuffle again, press the button again — every press makes a fresh order. To shuffle a different list, select all, delete, and paste the new one. The count updates instantly, so you can check that the new list has the right number of lines before you shuffle.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — your list never leaves your device. It works offline once the page has loaded, so you can use it in a classroom with no signal or anywhere else you need a fair order. Try it with something real before you need it: paste your class list or your raffle entries, shuffle once, and see the result.

Frequently Asked Questions

No. The shuffle only changes the order. The default list has 5 lines — Apple, Banana, Cherry, Date, Elderberry — and the shuffled output always has the same 5 lines. The count shown is 5 before and after. Blank lines count as lines, so remove them first if you do not want them in the result.

Yes, within the limits of a computer random number source. It uses the Fisher-Yates method with Math.random, seeded by the current time, so every possible order is equally likely. A list of 5 lines has 120 possible orders and each has a 1 in 120 chance. Pressing the button twice gives two different orders almost every time.

There is no set limit on this page. Lists of a few hundred lines shuffle in a fraction of a second, and lists of a few thousand work too. Very large pastes depend on your browser, but anything a person would type or copy — a class list, a raffle list, a set of questions — is far below any limit.

Yes. Everything runs in your browser — your list is never uploaded, stored, or sent anywhere. You can use it offline once the page has loaded, and you can paste names or entries without worrying about who sees them.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.