Skip to content

Permutation Generator

Type your items, one per line (8 different items at most; more when many repeat and are counted once), and the page gives the exact number of orders they can be arranged in and lists them in a fixed, repeatable sequence, up to 5,040 at a time (8 different items make 40,320, so the rest are counted but not shown). Repeated items are treated as identical by default, so a, a, b gives 3 orders and not 6. Copy the list or a CSV of it.

Possible orders

6 orders

3 items · all items different · showing 6

Options

  1. 1. A | B | C
  2. 2. A | C | B
  3. 3. B | A | C
  4. 4. B | C | A
  5. 5. C | A | B
  6. 6. C | B | A

n different items make n! orders (3 give 6, 4 give 24, 8 give 40,320). Orders come in a fixed sequence by the position of each item in your list, nothing is random. In the CSV, items starting with = + − @ get a leading apostrophe. Nothing you type leaves your browser.

How it works

  1. Type your items, one per line, 60 characters each. A list is accepted when it makes 40,320 orders or fewer: 8 different items, or more when many repeat and are counted once.
  2. Leave “count repeated items once” ticked to skip identical orders, or untick it to treat every line as different.
  3. Choose how many orders to show, up to 5,040 (the default is 120).
  4. Read the count, scroll the numbered list and copy it, or copy the CSV to open in a spreadsheet.

What people use it for

  • Counting the ways to arrange something

    See that 4 speakers can take the stage in 24 different orders, and read each one.

  • Puzzles and games

    List the possible orders of a code, a lock or a seating chain before you test them.

  • Test cases

    Get every order of a few steps or inputs to check that a process does not depend on their sequence.

Questions

How many orders are there?
For n different items there are n! = n × (n − 1) × … × 1 orders: 3 items give 6, 4 items give 24, 8 items give 40,320. When some items repeat, the count is n! divided by the factorial of each repeat count: a, a, b gives 3! ÷ 2! = 3. Counts are computed exactly, with no rounding.
In which sequence are the orders listed?
In lexicographic order by the position where each item first appears in your list. With repeated items counted once, the first order puts equal items together (a, b, a starts with a, a, b); with every line counted as different, the first order is your list as typed. The following orders come from a fixed rule, so the same input always gives the same list. Nothing is random.
Why is a long list refused, and what if I type none?
The limit is on the number of orders, not on the lines: 9 different items already make 362,880 orders and 12 make 479,001,600, far more than a page can show or a browser can build quickly, so such a list is refused with its count instead of freezing the tab (counts up to 60 digits are exact, larger ones are given as digits and a power of ten). Beyond 1,000 lines the page refuses at once, before counting anything, because the count itself would take too long. Nine lines that all say “a” are 1 order when repeated items are counted once, so they are accepted. An empty list gives a message rather than one empty order: mathematically 0! = 1, but a blank box is far more likely a forgotten input than a request for the empty arrangement.
Is the CSV safe to open in a spreadsheet?
Items that start with =, +, − or @ get a leading apostrophe so a spreadsheet reads them as text and not as a formula. Quotes and commas are escaped. Nothing you type leaves your browser.