Anagram from a String Creator
Generate all possible anagrams from any string. Find unique letter permutations instantly with this free online anagram creator tool.
About
An anagram is a rearrangement of every character in a source string to produce a new sequence. The number of distinct anagrams for a string of length n with repeated characters is given by the multinomial coefficient: n! divided by the product of each character frequency factorial. A 5-letter string with all unique characters yields 120 permutations. A 10-letter string yields 3,628,800. Miscounting or naive enumeration causes memory exhaustion and browser crashes. This tool uses Heapβs algorithm for exact enumeration on short inputs (β€ 8 characters) and Fisher-Yates random sampling for longer strings, with automatic deduplication for repeated letters.
Pro tip: strings with many repeated characters drastically reduce unique output count. The word βMISSISSIPPIβ has 11 letters but only 34,650 unique anagrams instead of 39,916,800. This tool computes in a background thread to keep your browser responsive. Results are capped at 10,000 displayed entries for practical usability. Note: this tool generates character-level permutations. It does not filter for dictionary words.
Formulas
The total number of distinct anagrams (permutations) of a string accounts for repeated characters using the multinomial formula:
Where P = total unique permutations, n = total number of characters in the string, r1, r2, β¦, rk = frequency count of each distinct character, and k = number of distinct characters.
For exhaustive generation (strings β€ 8 chars), Heapβs algorithm produces all n! permutations in-place with O(n!) time complexity. Duplicates are eliminated by inserting each result into a Set. For longer strings, the Fisher-Yates shuffle runs in O(n) per sample, generating random unique anagrams until the cap of 10,000 is reached or a stall threshold is hit.
Reference Data
| String Length (n) | All Unique: n! | All Same Letter | 2 Repeated (e.g., AABB...) | Approx. Compute Time |
|---|---|---|---|---|
| 3 | 6 | 1 | 3 | < 1 ms |
| 4 | 24 | 1 | 6 | < 1 ms |
| 5 | 120 | 1 | 10 | < 1 ms |
| 6 | 720 | 1 | 90 | < 5 ms |
| 7 | 5,040 | 1 | 630 | < 20 ms |
| 8 | 40,320 | 1 | 2,520 | < 100 ms |
| 9 | 362,880 | 1 | 15,120 | Random sampling mode |
| 10 | 3,628,800 | 1 | 113,400 | Random sampling mode |
| 11 | 39,916,800 | 1 | 831,600 | Random sampling mode |
| 12 | 479,001,600 | 1 | 7,484,400 | Random sampling mode |
| 13 | 6,227,020,800 | 1 | 64,864,800 | Random sampling mode |
| 14 | 87,178,291,200 | 1 | 726,485,760 | Random sampling mode |
| 15 | 1,307,674,368,000 | 1 | 7,264,857,600 | Random sampling mode |