Skip to content
AldeaCode Logo
Combinations100% local · 0 bytes sent

Permutation Generator

Generate every permutation of an input list using Heap's algorithm: with N items there are N! orderings. The tool computes the total upfront, warns when output gets large (8! is 40,320, 10! is 3.6 million), and blocks when crossing the safe limit so your tab stays responsive.

Loading…

How it works

Heap's algorithm enumerates every permutation in place using O(1) extra memory per step, swapping pairs based on a counter. We yield each permutation lazily so we can apply size guards and stop early when needed.

How to use it

  1. Paste the items

    Drop in a small list of items, one per line. Watch the count: N items produce N! permutations, which grows very fast.

  2. Pick separator and check size

    Choose the separator that joins items in each permutation. The tool computes N! and warns when output gets large (8! is 40,320).

  3. Generate with Heap's algorithm

    Heap's algorithm enumerates every permutation in place with O(1) extra memory per step. The size guard blocks unsafe N to keep the tab ok.

  4. Copy the permutations

    Take the output into a brute-force test, a sorting demo, a classroom factorial example, or a vocabulary exercise.

Use cases

Brute-force every order in a small puzzle.

Generate test cases for sorting algorithms.

Explore every reading order of a paragraph for puzzle creation.

Build vocabulary exercises with words in every order.

Educational demo of factorial growth.

When NOT to use it

  • With more than 10 items unless you really need 3.6M+ outputs. The tool blocks past 1M, but even 9! is 362,880 lines, too many to scan.
  • When duplicates exist in the input. Heap's algorithm treats every element as unique, so duplicate values produce duplicate permutations. Run dedupe afterwards.
  • As a test data generator if order does not matter. Use combinations instead, the count is much smaller.

Your data never leaves your browser

Every utility runs entirely on your device. Nothing is uploaded, nothing is stored on a server. You can disconnect from the internet and they keep working.

Frequently asked questions

Related tools