Barker Code Calculator

Check any binary code for Barker sidelobes. Pick a Barker code or paste your own ±1, +/− or 0/1 sequence to get its autocorrelation, peak sidelobe level, peak-to-sidelobe ratio and merit factor, or search every sequence of a length for the lowest sidelobes.

Calculator Electronics Updated Oct 13, 2026
Learn how this works
How to Use
  1. Pick a known Barker code from the list, or paste your own sequence: + − signs, ±1 values, or 0/1 bits (1 → +1, 0 → −1).
  2. Read the peak sidelobe level, the peak-to-sidelobe ratio in dB, the merit factor and the Barker verdict beside the plot. Results update as you type.
  3. Tick Periodic autocorrelation to compare the cyclic (repeated-code) correlation, or Zoom on sidelobes to see small sidelobes next to a tall peak.
  4. Switch to Exhaustive search and pick a range of lengths (up to 28) to find the lowest peak sidelobe possible at each length and count the Barker sequences.
  5. Press a preset to load a ready-made example, and check Show Work for every step.
Input
fills the sequence
+ − · ±1 · 0/1 · max 4,096 chips
Presets
Chips and Matched-Filter Output
Peak sidelobe
—
Peak / sidelobe
—
Merit factor
—
Barker?
—

Worked Example

Barker-13: + + + + + − − + + − + − +. Slide the code past itself and add the products of the chips that overlap. At shift 0 all 13 products are +1, so C(0) = 13. At shift 1 the 12 overlapping products add to 0, at shift 2 the 11 products add to 1, and the pattern carries on: C(1) to C(12) = 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1. The peak sidelobe level is 1, so the peak-to-sidelobe ratio is 20 × log10(13 ÷ 1) = 22.28 dB. The six sidelobes of 1 add to 6, so the merit factor is 13² ÷ (2 × 6) = 169 ÷ 12 = 14.08, and every |C(k)| ≤ 1 makes it a Barker sequence.

Common mistake 1: correlating the 0/1 bits directly. Written as bits, Barker-13 is 1111100110101. Multiplying the 0s and 1s as they are only counts overlapping 1s: C(0) = 9 and C(1) = C(2) = 5, which looks like a 5.11 dB code (20 × log10(9 ÷ 5)). Map the bits to chips first (1 → +1, 0 → −1; the opposite mapping gives the same result) and the sidelobes drop back to 0 and 1.

Common mistake 2: using the periodic instead of the aperiodic correlation. The 15-chip m-sequence 000100110101111 has a periodic autocorrelation of −1 at every nonzero shift, so if the code were repeated back to back it would look better than a Barker code. A radar pulse or a single sync word is sent once, and the matched filter then sees the aperiodic correlation: C(1) to C(14) = 0, 1, 2, 1, 0, 1, −2, 1, −2, −1, −2, −3, −2, −1. Its peak sidelobe is 3 at shift 12, giving 20 × log10(15 ÷ 3) = 13.98 dB and a merit factor of 225 ÷ 70 = 3.21. It is not a Barker sequence.

Show Work

Enter a sequence to see the step-by-step breakdown.

Formulas

Aperiodic autocorrelation
C(k) = Σi=0N−1−k ai·ai+k
ai = ±1; C(0) = N and C(−k) = C(k). This is the matched-filter output for one pulse.
Periodic autocorrelation
P(k) = Σi=0N−1 ai·a(i+k) mod N = C(k) + C(N−k)
For a code repeated back to back
Peak sidelobe level
PSL = max1≤k≤N−1 |C(k)|
The largest false peak the matched filter can give
Peak-to-sidelobe ratio
PSR = 20·log10(N ÷ PSL) dB
Barker-13: 20·log1013 = 22.28 dB
Merit factor and ISL
F = N² ÷ (2·Σk=1N−1 C(k)²)
Integrated sidelobe level ISL = 10·log10(1/F) dB, the total sidelobe energy against the peak
Barker condition
|C(k)| ≤ 1 for every 1 ≤ k ≤ N−1
C(k) has the parity of N − k, so it is 0 or ±1 alternately
Equivalent codes
aN−1−i, −ai, (−1)iai
Reversing, negating or flipping every other chip keeps every |C(k)|, so the PSL and merit factor do not change

Background: Why Barker Codes Stop at 13

R. H. Barker described the sequences in 1953, in “Group synchronizing of binary digital systems” (in Communication Theory, edited by W. Jackson). He wanted a synchronising pattern whose correlator output was much larger when it lined up than at any partial overlap, gave examples of lengths 3, 7 and 11, and suspected that longer ones did not exist. Later engineers relaxed his condition to |C(k)| ≤ 1, which is the definition used today, and took the codes into pulse compression and radar, where a long coded pulse carries more energy while the matched filter still resolves a single chip.

Only seven lengths have Barker sequences: 2, 3, 4, 5, 7, 11 and 13. Lengths 2 and 4 each have two codes that are not reversed or negated copies of each other (+ + and + −; + + + − and + + − +), which is why the list above offers both. For odd lengths, R. Turyn and J. Storer proved in 1961 that none is longer than 13 (On binary sequences, Proc. American Mathematical Society 12, 394–399); K.-U. Schmidt and J. Willms published a shorter proof in 2016. For even lengths, Turyn and Storer pointed out that a Barker sequence would also have every periodic sidelobe equal to zero, and in 1965 Turyn showed that such a length must be 4u² for an odd u that is not a prime power, ruling out every even length from 14 to 12,099.

The even case appears to have been closed in 2026. A periodic sequence with all sidelobes zero is the first row of a circulant Hadamard matrix, and an AI-generated OpenAI preprint (The circulant Hadamard conjecture, 23 September 2026) claims that these exist only in orders 1 and 4. Its machine-checked Lean proof, published with Lean Comparator checks, covers that classification and the even Barker lengths, 2 and 4; the odd lengths rest on the 1961 theorem, which the formal statement does not include. The result has not yet been peer reviewed. See what “Lean-checked” means.

Where a Barker code is too short, engineers use codes with the lowest peak sidelobe found by exhaustive search. A. N. Leukhin and E. N. Potekhin list them up to length 68: a peak sidelobe of 2 is possible at every non-Barker length up to 21 and again at 25 and 28, and 3 is the best possible from 29 to 48.

Sources: J. Jedwab, “What can be used instead of a Barker sequence?” (Contemporary Mathematics 461, 2008); K.-U. Schmidt and J. Willms, “Barker sequences of odd length” (Designs, Codes and Cryptography 80, 2016); OpenAI, Lean scope note for result 179; A. N. Leukhin and E. N. Potekhin, “Binary sequences with minimum peak sidelobe level up to length 68”; IEEE Std 802.11, 1999 Edition, subclause 15.4.6.3.

About This Calculator

This calculator computes the full aperiodic autocorrelation of any binary code up to 4,096 chips and reports its peak sidelobe level, peak-to-sidelobe ratio, integrated sidelobe level, merit factor and whether it is a Barker sequence. It reads + and − signs, ±1 values or 0/1 bits, and can add the periodic autocorrelation for a code that repeats. The plot shows the chips and the matched-filter output with the ±1 Barker band marked, and the zoom brings small sidelobes into view next to a tall peak.

The exhaustive search checks every sequence of each length from 2 to 28 chips, using branch and bound so whole families of sequences are ruled out at once, and reports the lowest peak sidelobe possible, how many sequences reach it, and how many are Barker sequences. It runs in a background thread, so the page stays responsive and you can stop it at any time. Everything runs in your browser; nothing you enter is sent to a server.

It is for radar, sonar and radio engineers choosing a pulse-compression or spreading code, for anyone checking a sync word, and for students who want to see for themselves that no Barker code exists at lengths such as 6, 8, 9, 10 and 12.

Related calculators: Radar Range Equation Calculator, LFSR Maximal Period Calculator, and RF Link Budget Calculator.

Frequently Asked Questions

What is a Barker code?

A Barker code is a sequence of +1 and −1 chips whose aperiodic autocorrelation C(k) is 0, +1 or −1 at every shift k other than zero. At zero shift it equals the length N, so a matched filter gives a sharp peak of N with sidelobes no bigger than 1. Barker codes exist for lengths 2, 3, 4, 5, 7, 11 and 13; for example Barker-13 is + + + + + − − + + − + − +.

Why is 13 the longest Barker code?

For odd lengths, Turyn and Storer proved in 1961 that no Barker sequence is longer than 13. For even lengths, any Barker sequence longer than 2 would have every periodic sidelobe zero, which makes it the first row of a circulant Hadamard matrix. A 2026 AI-generated preprint, not yet peer reviewed, claims to settle that case with a machine-checked Lean proof (published with Lean Comparator checks): such matrices exist only in orders 1 and 4, so even Barker codes stop at length 4. See what “Lean-checked” means.

How do I work out the peak-to-sidelobe ratio in dB?

Divide the main peak (the length N) by the peak sidelobe level and take 20 × log10, because the matched-filter output is an amplitude. Barker-13 gives 20 × log10(13 ÷ 1) = 22.28 dB, Barker-11 gives 20.83 dB and Barker-7 gives 16.90 dB.

What is the merit factor of a binary code?

The merit factor F = N² ÷ (2 × the sum of C(k)² over k = 1 to N − 1) measures the total sidelobe energy rather than the single worst sidelobe. Golay named it in 1972. Barker-13 has six sidelobes of ±1, so F = 169 ÷ 12 = 14.08; a 15-chip m-sequence scores only 3.21.

Which Barker code does Wi-Fi use?

The original IEEE 802.11 direct-sequence PHY (1 Mbit/s DBPSK and 2 Mbit/s DQPSK) spreads every symbol with the 11-chip sequence +1, −1, +1, +1, −1, +1, +1, +1, −1, −1, −1, leftmost chip first (IEEE Std 802.11, 1999 Edition, 15.4.6.3), at an 11 MHz chip rate. It is Barker-11 reversed and negated, which leaves the autocorrelation unchanged: sidelobes of 0 and −1 and a 20.83 dB peak-to-sidelobe ratio.

How do I use the Barker Code Calculator?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Radar pulse compression

A 13-chip Barker pulse with 1 µs chips carries the energy of a 13 µs pulse but resolves targets 150 m apart instead of 1,949 m, with range sidelobes 22.28 dB below the peak.

Wi-Fi DSSS spreading

IEEE 802.11 at 1 and 2 Mbit/s spreads each symbol over 11 chips at 11 MHz. The 802.11 preset shows its sidelobes stay at 0 or −1, and the spreading gives 10 × log10(11) = 10.41 dB of processing gain.

Frame sync words

A Barker-7 sync word gives a correlator peak of 7 against sidelobes of at most 1, a 16.90 dB margin against a false lock on a partial overlap.

Checking a code from a datasheet

Paste the bits as 0/1. The 15-chip m-sequence 000100110101111 has perfect periodic sidelobes of −1 but an aperiodic peak sidelobe of 3, only 13.98 dB.

Choosing a longer code

The exhaustive search shows the best 24-chip code has a peak sidelobe of 3 (18.06 dB), worse than Barker-13, while 28 chips can reach a sidelobe of 2 (22.92 dB).

Last updated: