I typed “The meaning of life” into a browser and, 25.7 seconds later, it answered
The fine game of nil
Not quite philosophy, perhaps—but it is an exact anagram. Every letter in the original appears once in the result.
The page had evaluated 222,534 exact combinations, retained the strongest 1,200 phrases, and ranked that one first. Four workers were exploring about 36,000 branches per second, all inside the browser.
That experiment became Anagram Architect, a phrase-anagram generator I built with Rust, WebAssembly, and JavaScript.
Here is the short technical story behind it.
Exact is easy; meaningful is hard
Checking whether two finished phrases are anagrams is straightforward. Normalize them to lowercase letters, count each character, and compare the two frequency tables.
Generating a good multi-word anagram is a different problem.
The engine must repeatedly choose a dictionary word, subtract its letters, and search the remainder:
remaining letters = source letters - chosen word letters
Enter fullscreen mode Exit fullscreen mode
If a count becomes negative, that branch is impossible. If every count reaches zero, the engine has found an exact phrase.
Unfortunately, most exact phrases are terrible English. A dictionary can tell the engine that several words exist. It cannot tell it whether people would ever put those words together.
Rust handles the combinatorial search
The search core is written in Rust and compiled to WebAssembly. Each source phrase and dictionary word becomes a compact 26-letter signature.
Before following a branch, the engine applies several inexpensive checks:
- Does the word fit the remaining letters?
- Can the remainder still be completed by the available vocabulary?
- Has this dead remainder already been explored?
- Would the phrase exceed the selected word-count limits?
Those checks eliminate impossible work without eliminating a valid answer.
Rust was useful here because the hot path relies on small fixed arrays, explicit integer fields, compact indexes, and a large number of predictable mutations. WebAssembly lets that engine run on the user’s device without installing an application.
Web Workers keep the interface alive
A deep recursive search can easily freeze a browser tab. Anagram Architect divides the candidate space into shards and sends them to multiple Web Workers.
Each worker loads the WASM engine, explores its own shard, and periodically reports:
- branches searched;
- exact combinations found;
- duplicate paths pruned;
- progress through its assigned work; and
- its strongest candidates.
The main JavaScript thread merges those candidates into one stable ranking while continuing to render progress and respond to cancellation.
That is what the graph in the interface represents: recent search throughput measured in branches per second. It is not decorative animation; it is a view into the work the local engine is actually doing.
Ranking is a separate language problem
Every displayed result is guaranteed to be exact. Its rank is only an estimate of how natural or memorable it sounds.
The ranking layer combines several signals:
- word frequency;
- likely parts of speech;
- common two- and three-word sequences;
- phrase shapes such as adjective–noun and verb–object;
- article and subject–verb agreement;
- penalties for obscure vocabulary; and
- bonuses for locally supported word order.
This distinction matters. A search engine can prove that “The fine game of nil” uses the right letters. It cannot mathematically prove that it is the funniest or most meaningful result.
I maintain a benchmark set of well-known anagrams to catch ranking regressions. Improving one famous phrase is not useful if the same change quietly buries five others.
Users can guide—and edit—the result
Sometimes the machine needs a hint. Advanced controls let users require, prefer, or exclude words and constrain the result with letter patterns or grammar templates such as:
[Noun] of [Noun]
[Verb] the [Noun]
[Adjective] [Noun]
Enter fullscreen mode Exit fullscreen mode
Finding a phrase is also not the end of the creative process. The Pick List acts as a small phrase workshop where a result can be reordered, individual words can be locked in place, and a selected word can be swapped for another word using exactly the same letters. Capitalization and punctuation can then be applied without changing the underlying anagram.
No anagram API receives the phrase
Names, unpublished titles, and private jokes can be sensitive. The dictionaries, language data, JavaScript, and WASM module are downloaded as static assets, but the entered phrase and generated candidates remain in the browser.
Local processing is not the same as “no network activity”—the page still has to load its files. It means there is no search endpoint receiving the user’s text.
So, did we find the meaning of life?
In this particular run, we searched 222,534 exact combinations in 25.7 seconds and found “The fine game of nil.” Timing varies with the phrase, settings, browser, and hardware, so 26 seconds is an observation rather than a benchmark promise.
But the result captures why I enjoy this project: exhaustive computation can establish correctness, while language models, heuristics, and human editing turn correctness into something surprising.
You can try Anagram Architect and see what your own name—or favorite phrase—turns into.
If you have built a search-heavy browser tool with Rust or WebAssembly, I would love to hear where you drew the boundary between the UI and the computational engine.
