Markov Chain Text Generator
Feed in sample text and generate new, plausible-sounding text with a Markov chain. The tool builds an n-gram transition model — for each sequence of order consecutive words it records which words historically followed and how often — then generates text by sampling the next word from that distribution, starting from a random seed state. A numeric seed makes the output reproducible. Everything stays in your browser.
Sample text
Generated text
A Markov chain of order k models the probability of the next word given the previous k words. The tool builds the transition table from your input (each k-gram maps to the multiset of words that followed it in the sample), then walks the chain: at each step it picks the next word with probability proportional to its recorded frequency after the current k-gram. When the current state was never seen, it restarts from a random observed k-gram. A seed drives a deterministic PRNG (mulberry32) so the same text + order + seed always yields the same output; change the seed for a different sample. Larger order → more faithful but more repetitive; order 1 → more chaotic. Pairs with the N-Gram Frequency and Word Frequency tools. Everything runs locally — nothing leaves your browser.