Skip to content
100% local

LFSR generator

Simulate a linear feedback shift register from a feedback polynomial and a seed.

Output

LFSR generator

A linear feedback shift register shifts a fixed-width register one bit at a time, feeding the XOR of a chosen set of "tap" bits back into the top of the register while the bottom bit is shifted out as output. Chain enough steps together and you get a long, deterministic pseudorandom bit stream — the same technique behind CRC checks, spread-spectrum radio, BIST test patterns and old-school stream ciphers. This tool runs that simulation for any register width from 2 to 32 bits, so you can explore how a given polynomial and seed behave before wiring the same logic into hardware or firmware.

Set the register width, then enter the feedback polynomial (the tap positions) and the initial seed in binary, hex or decimal — whichever the input format option is set to. Output length picks how many steps to run, and output format controls whether each value is shown in binary, hex or decimal. Turn on batch mode to print the register's full state after every step, one per line, instead of a single concatenated bit stream — useful when you want to inspect the sequence of states rather than just the output bits.

The tool also reports the period: the number of steps before the register returns to its starting seed. A well-chosen polynomial on an n-bit register produces a maximal-length sequence with a period of 2ⁿ − 1, visiting every non-zero state exactly once before repeating — a handy way to check whether a polynomial you found in a textbook or datasheet is actually maximal. A seed of zero is rejected, since an all-zero register can never change state under XOR feedback; a seed or polynomial that doesn't fit the chosen width is rejected too, with a message telling you why.

Everything runs locally in your browser — the polynomial, seed and generated sequence never leave your device. Copy the result, download it as a .txt file, or send it straight into another tool's input to keep working with it.

FAQ

What counts as a "tap" or feedback polynomial here?
The polynomial is a bitmask: bit i set means bit i of the register is XORed into the feedback on every step. A common way to find good taps is to look up a maximal-length polynomial for your register width and convert its exponents into that bitmask.
Why is the period sometimes shown as "> N" instead of a number?
The register didn't return to the seed within the number of steps you generated. Either the sequence hasn't looped yet, or the chosen polynomial and seed sit on a shorter cycle than expected — increase the output length to find out.
What's the difference between the normal output and batch mode?
Without batch mode, the tool prints one continuous stream of the bits shifted out — the classic LFSR output. Batch mode instead prints the register's complete internal state after each step, one value per line, in your chosen output format.
Why does a zero seed give an error?
With XOR-based feedback, an all-zero register always feeds back zero, so it stays zero forever — there's no sequence to generate. Pick any non-zero seed that fits the register width.
Is my polynomial or seed uploaded anywhere?
No. The simulation runs entirely in your browser — nothing you enter here is sent to a server.