Last updated: August 1, 2026
LFSR Calculator
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Quick Answer
This LFSR calculator validates a binary seed and tap list, simulates XOR feedback shifts, returns the generated output bits, every visited state, the detected period, and whether the sequence is maximal-length.
An LFSR updates a binary register by XORing tapped bits, shifting the register, and emitting a repeatable output bit stream.
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Formula
feedbackBit = tap1 ⊕ tap2 ⊕ ... ⊕ tapk, nextState = feedbackBit followed by the shifted register
Where:
- b_i=Current register bits(bit)
- f=Feedback bit from XOR taps(bit)
- S_{next}=Next register state after shifting(bit string)
- t_i=Tap positions used in the XOR(position)
Worked Examples
3-bit maximal sequence
Start from 101 with taps at positions 3 and 1 for 7 steps.
- 1Use bits 3 and 1 to compute the feedback XOR.
- 2Shift right and insert the feedback bit on the left each step.
- 3Collect the output bit that leaves on the right.
- 4The seed returns after 7 steps, so the period is 7.
4-bit register
Use a 4-bit seed with taps that produce a longer cycle.
- 1Compute each feedback bit from the tapped positions.
- 2Record the state list after each shift.
- 3Compare the period with 2^4 - 1 = 15.
- 4The output stays deterministic for the same seed and taps.
Short custom run
Simulate only 5 steps to inspect intermediate states.
- 1Normalize the tap positions.
- 2Perform five XOR-and-shift updates.
- 3Read the output bit stream.
- 4Inspect the final register state for the next run.
Tap validation
See how the calculator rejects impossible tap positions.
- 1Count seed length first.
- 2Compare each tap against the valid range.
- 3Reject taps outside the register width.
- 4Request a new valid tap list.
Introduction
An LFSR, or linear feedback shift register, is a compact deterministic generator that updates a binary register by XORing selected taps and shifting the bits. It appears in testing, coding theory, stream ciphers, and pseudo-random sequence design.
What an LFSR Is
An LFSR stores a binary state and updates it through feedback and shifting.
Each step produces one output bit
Tap positions define the feedback rule
The same seed always gives the same sequence
The all-zero state locks permanently
How Tap Logic Works
Selected register bits are XORed to create the next leftmost bit.
Tap positions are counted from the left
XOR returns 1 when an odd number of tapped bits are 1
The rightmost bit becomes the output bit
Every update shifts the remaining bits right
Understanding the Period
The period is the number of shifts required before the seed appears again.
Maximum period is 2^n - 1 for n bits
Only non-zero states participate in the main cycle
Tap choice controls the cycle length
Short periods indicate a weaker sequence
How to Use the Calculator
Choose a seed, list the taps, and decide how many steps to simulate.
Enter a binary seed
List taps such as 3,1
Set the step count
Read generated bits and visited states
Common Applications
LFSRs are useful anywhere repeatable bit patterns matter.
Built-in self-test patterns
Scramblers and descramblers
Toy stream-cipher demonstrations
Pseudo-random test data
Validation Rules
Good input is essential because some states or tap sets are mathematically invalid.
Seed must contain only 0 and 1
Seed cannot be all zeros
Taps must be unique integers
Steps must be a positive whole number
Reading the Results
The calculator reports the output stream, every visited state, and whether the cycle is maximal-length.
Generated bits help compare prefixes
States show internal transitions
Period reveals cycle efficiency
Final state can seed the next batch
FAQs
Why is the all-zero seed rejected?
In a standard XOR-feedback LFSR, the all-zero state feeds back to itself forever and produces no useful sequence.
How are taps numbered?
This calculator counts taps from the leftmost bit starting at 1.
What does maximal length mean?
A maximal-length LFSR visits every non-zero n-bit state before repeating, so its period is 2^n - 1.
Can two different tap sets give different periods?
Yes. The tap polynomial controls the cycle structure, so different taps can shorten or lengthen the period.
What bit becomes the output?
The rightmost bit shifted out during each update is appended to the generated bit stream.
Can I use spaces between taps?
Yes. Commas, spaces, and semicolons are all accepted as tap separators.
Is an LFSR truly random?
No. It is deterministic and repeatable, which is useful for engineering tests but not equivalent to true randomness.