Vernam Cipher Decoder

Paste the code, type a key just as long, and set Mode to Letter shift or XOR on five bits.

This is a sample. Type or paste your own code over it.

Message

SENDMOREBISCUITS
Mode
More options
  • Message 16, key 16.
  • With the spaces back: send more biscuits
The working, step by step (16 rows)

Each code letter minus its key letter, counting A as 0.

#WorkingMessage
1X (23) minus F (5) is 18S
2H (7) minus D (3) is 4E
3D (3) minus Q (16) is −13, plus 26 is 13N
4L (11) minus I (8) is 3D
5G (6) minus U (20) is −14, plus 26 is 12M
6Y (24) minus K (10) is 14O
7F (5) minus O (14) is −9, plus 26 is 17R
8R (17) minus N (13) is 4E
9C (2) minus B (1) is 1B
10Y (24) minus Q (16) is 8I
11O (14) minus W (22) is −8, plus 26 is 18S
12H (7) minus F (5) is 2C
13C (2) minus I (8) is −6, plus 26 is 20U
14Q (16) minus I (8) is 8I
15O (14) minus V (21) is −7, plus 26 is 19T
16Q (16) minus Y (24) is −8, plus 26 is 18S

How it works

This Vernam cipher decoder pairs every character of your code with one character of a key just as long. It works by letter values from A = 0 to Z = 25 or by XOR on five-bit tape codes, every step shown.

Read the full guide

Subtract the key, letter by letter

Letter shift subtracts key from code. EQNVZ under XMCKL reads hello: E is 4, X is 23, and 4 minus 23 plus 26 is 7, H. Under XOR on five bits the same key applied twice returns the message. A Key shorter than the message is refused.

Five impulses, 32 codes

Gilbert Vernam's 1919 patent, as Wikipedia gives it, has A as ++---, the key B as +--++ and the result -+-++, G. The table here is ITA2, the 1932 standard that example agrees with. Six of the 32 codes are not letters and take Bletchley Park's names: / for null, 9 for space, then 3, 4, 5 and 8. A / in the output means message and key matched.

Tips
  • Any reading fits some key. With KTCDOWLJJGZWYQWM as Key, the opening code reads no biscuits please, not send more biscuits.
  • No 8-bit ASCII here. XOR on five bits takes letters, / 9 3 4 5 8, or groups like 11000.

Questions and answers

Is a Vernam cipher the same as a one-time pad?

Only under four conditions: the key is at least as long as the message, truly random, never reused and kept completely secret. Under Encode, New random key draws on your browser's generator, an algorithm, so it makes a stream cipher. Keep this page for puzzles.

Why can a key never be used twice?

Because the key cancels. XOR two codes from one key and both messages remain, XORed together. Codebreakers call that a depth. Set Mode to XOR on five bits. Paste QRCCSFMKH4TTETJPRK as code and QRCCSFMKH4BQUGK48L as Key. Ten / marks come first: both messages start send more.

What is the difference between a Vernam and a Vigenère cipher?

Key length. A Vigenère key is a short word that starts again, and Kasiski published a general attack on that repetition in 1863. A Vernam key runs the whole message and is never reused. Under More options, Repeat a short key decodes a Vigenère.

All 58 values and codes

Letter values for letter shift mode, A = 0 to Z = 25 26

  • A = 0 A counts as 0. As a key letter it changes nothing, so the message letter goes out as itself. A random key holds an A about one letter in 26, and that is correct: a key maker that avoided A would be less random, not safer.
  • B = 1 B counts as 1. As a key letter it moves the message letter 1 place on, so E becomes F. To decode, count 1 place back, or add Z (25). In the opening example B (1) plus B (1) is 2: C.
  • C = 2 C counts as 2. As a key letter it moves the message letter 2 places on, so E becomes G. To decode, count 2 places back, or add Y (24). In Wikipedia's example L (11) plus C (2) is 13: N.
  • D = 3 D counts as 3. As a key letter it moves the message letter 3 places on, so E becomes H. To decode, count 3 places back, or add X (23). In the opening example E (4) plus D (3) is 7: H.
Show all 58 values and codes (54 more)

Letter values for letter shift mode, A = 0 to Z = 25, continued

  • E = 4 E counts as 4. As a key letter it moves the message letter 4 places on, so E becomes I. To decode, count 4 places back, or add W (22).
  • F = 5 F counts as 5. As a key letter it moves the message letter 5 places on, so E becomes J. To decode, count 5 places back, or add V (21). In the opening example S (18) plus F (5) is 23: X.
  • G = 6 G counts as 6. As a key letter it moves the message letter 6 places on, so E becomes K. To decode, count 6 places back, or add U (20).
  • H = 7 H counts as 7. As a key letter it moves the message letter 7 places on, so E becomes L. To decode, count 7 places back, or add T (19).
  • I = 8 I counts as 8. As a key letter it moves the message letter 8 places on, so E becomes M. To decode, count 8 places back, or add S (18). In the opening example D (3) plus I (8) is 11: L.
  • J = 9 J counts as 9. As a key letter it moves the message letter 9 places on, so E becomes N. To decode, count 9 places back, or add R (17).
  • K = 10 K counts as 10. As a key letter it moves the message letter 10 places on, so E becomes O. To decode, count 10 places back, or add Q (16). In Wikipedia's example L (11) plus K (10) is 21: V.
  • L = 11 L counts as 11. As a key letter it moves the message letter 11 places on, so E becomes P. To decode, count 11 places back, or add P (15). In Wikipedia's example O (14) plus L (11) is 25: Z.
  • M = 12 M counts as 12. As a key letter it moves the message letter 12 places on, so E becomes Q. To decode, count 12 places back, or add O (14). In Wikipedia's example E (4) plus M (12) is 16: Q.
  • N = 13 N counts as 13, half of 26. As a key letter it moves the message letter 13 places on, so E becomes R, and adding N a second time brings the letter back. It is the only key letter besides A that undoes itself. In the opening example E (4) plus N (13) is 17: R.
  • O = 14 O counts as 14. As a key letter it moves the message letter 14 places on, so E becomes S. To decode, count 14 places back, or add M (12). In the opening example R (17) plus O (14) is 31, less 26 is 5: F.
  • P = 15 P counts as 15. As a key letter it moves the message letter 15 places on, so E becomes T. To decode, count 15 places back, or add L (11).
  • Q = 16 Q counts as 16. As a key letter it moves the message letter 16 places on, so E becomes U. To decode, count 16 places back, or add K (10). In the opening example N (13) plus Q (16) is 29, less 26 is 3: D.
  • R = 17 R counts as 17. As a key letter it moves the message letter 17 places on, so E becomes V. To decode, count 17 places back, or add J (9).
  • S = 18 S counts as 18. As a key letter it moves the message letter 18 places on, so E becomes W. To decode, count 18 places back, or add I (8).
  • T = 19 T counts as 19. As a key letter it moves the message letter 19 places on, so E becomes X. To decode, count 19 places back, or add H (7).
  • U = 20 U counts as 20. As a key letter it moves the message letter 20 places on, so E becomes Y. To decode, count 20 places back, or add G (6). In the opening example M (12) plus U (20) is 32, less 26 is 6: G.
  • V = 21 V counts as 21. As a key letter it moves the message letter 21 places on, so E becomes Z. To decode, count 21 places back, or add F (5). In the opening example T (19) plus V (21) is 40, less 26 is 14: O.
  • W = 22 W counts as 22. As a key letter it moves the message letter 22 places on, so E becomes A. To decode, count 22 places back, or add E (4). In the opening example S (18) plus W (22) is 40, less 26 is 14: O.
  • X = 23 X counts as 23. As a key letter it moves the message letter 23 places on, so E becomes B. To decode, count 23 places back, or add D (3). In Wikipedia's example H (7) plus X (23) is 30, less 26 is 4: E.
  • Y = 24 Y counts as 24. As a key letter it moves the message letter 24 places on, so E becomes C. To decode, count 24 places back, or add C (2). In the opening example S (18) plus Y (24) is 42, less 26 is 16: Q.
  • Z = 25 Z counts as 25. As a key letter it moves the message letter 25 places on, which is the same as 1 place back: E becomes D. To undo it, add B.

Five-bit tape codes for the 26 letters 26

  • A = 11000 A is 11000 on the tape, 2 marks and 3 spaces, written ++--- in plus and minus. After a figure shift the same code prints a hyphen or minus sign. Flip all five impulses and it becomes M. Wikipedia's example from Vernam's patent starts here: A with the key B gives G.
  • B = 10011 B is 10011 on the tape, 3 marks and 2 spaces, written +--++ in plus and minus. After a figure shift the same code prints a question mark. Flip all five impulses and it becomes I. The key character of Wikipedia's example from Vernam's patent: A with B gives G, and G with B gives A back.
  • C = 01110 C is 01110 on the tape, 3 marks and 2 spaces, written -+++- in plus and minus. After a figure shift the same code prints a colon. Flip all five impulses and it becomes Z.
  • D = 10010 D is 10010 on the tape, 2 marks and 3 spaces, written +--+- in plus and minus. After a figure shift the same code sends WRU, who are you, in ITA2 and prints a dollar sign on a US teletype. Flip all five impulses and it becomes P.
  • E = 10000 E is 10000 on the tape, 1 mark and 4 spaces, written +---- in plus and minus. After a figure shift the same code prints 3. Flip all five impulses and it becomes V.
  • F = 10110 F is 10110 on the tape, 3 marks and 2 spaces, written +-++- in plus and minus. After a figure shift the same code prints an exclamation mark, a position ITA2 leaves to national use. Flip all five impulses and it becomes L.
  • G = 01011 G is 01011 on the tape, 3 marks and 2 spaces, written -+-++ in plus and minus. After a figure shift the same code prints an ampersand, a position ITA2 leaves to national use. Flip all five impulses and it becomes S. The result in Wikipedia's example from Vernam's patent: A (11000) with B (10011) is 01011.
  • H = 00101 H is 00101 on the tape, 2 marks and 3 spaces, written --+-+ in plus and minus. After a figure shift the same code prints a pound sign in ITA2 and a hash sign on a US teletype, a position ITA2 leaves to national use. Flip all five impulses and it becomes J.
  • I = 01100 I is 01100 on the tape, 2 marks and 3 spaces, written -++-- in plus and minus. After a figure shift the same code prints 8. Flip all five impulses and it becomes B.
  • J = 11010 J is 11010 on the tape, 3 marks and 2 spaces, written ++-+- in plus and minus. After a figure shift the same code rings the bell in ITA2 and prints an apostrophe on a US teletype. Flip all five impulses and it becomes H.
  • K = 11110 K is 11110 on the tape, 4 marks and 1 space, written ++++- in plus and minus. After a figure shift the same code prints an opening bracket. Flip all five impulses and it becomes T.
  • L = 01001 L is 01001 on the tape, 2 marks and 3 spaces, written -+--+ in plus and minus. After a figure shift the same code prints a closing bracket. Flip all five impulses and it becomes F.
  • M = 00111 M is 00111 on the tape, 3 marks and 2 spaces, written --+++ in plus and minus. After a figure shift the same code prints a full stop. Flip all five impulses and it becomes A.
  • N = 00110 N is 00110 on the tape, 2 marks and 3 spaces, written --++- in plus and minus. After a figure shift the same code prints a comma. Flip all five impulses and it becomes W.
  • O = 00011 O is 00011 on the tape, 2 marks and 3 spaces, written ---++ in plus and minus. After a figure shift the same code prints 9. Flip all five impulses and it becomes U.
  • P = 01101 P is 01101 on the tape, 3 marks and 2 spaces, written -++-+ in plus and minus. After a figure shift the same code prints 0. Flip all five impulses and it becomes D.
  • Q = 11101 Q is 11101 on the tape, 4 marks and 1 space, written +++-+ in plus and minus. After a figure shift the same code prints 1. Flip all five impulses and it becomes carriage return (3).
  • R = 01010 R is 01010 on the tape, 2 marks and 3 spaces, written -+-+- in plus and minus. After a figure shift the same code prints 4. Flip all five impulses and it becomes Y. R and Y alternate mark and space in opposite phase, which is why Wikipedia's Baudot article gives RYRYRY as the usual test signal.
  • S = 10100 S is 10100 on the tape, 2 marks and 3 spaces, written +-+-- in plus and minus. After a figure shift the same code prints an apostrophe in ITA2 and rings the bell on a US teletype. Flip all five impulses and it becomes G.
  • T = 00001 T is 00001 on the tape, 1 mark and 4 spaces, written ----+ in plus and minus. After a figure shift the same code prints 5. Flip all five impulses and it becomes K.
  • U = 11100 U is 11100 on the tape, 3 marks and 2 spaces, written +++-- in plus and minus. After a figure shift the same code prints 7. Flip all five impulses and it becomes O.
  • V = 01111 V is 01111 on the tape, 4 marks and 1 space, written -++++ in plus and minus. After a figure shift the same code prints an equals sign in ITA2 and a semicolon on a US teletype. Flip all five impulses and it becomes E.
  • W = 11001 W is 11001 on the tape, 3 marks and 2 spaces, written ++--+ in plus and minus. After a figure shift the same code prints 2. Flip all five impulses and it becomes N.
  • X = 10111 X is 10111 on the tape, 4 marks and 1 space, written +-+++ in plus and minus. After a figure shift the same code prints a slash. Flip all five impulses and it becomes line feed (4).
  • Y = 10101 Y is 10101 on the tape, 3 marks and 2 spaces, written +-+-+ in plus and minus. After a figure shift the same code prints 6. Flip all five impulses and it becomes R. R and Y alternate mark and space in opposite phase, which is why Wikipedia's Baudot article gives RYRYRY as the usual test signal.
  • Z = 10001 Z is 10001 on the tape, 2 marks and 3 spaces, written +---+ in plus and minus. After a figure shift the same code prints a plus sign in ITA2 and a double quotation mark on a US teletype. Flip all five impulses and it becomes C.

Five-bit tape codes that are not letters 6

  • Carriage return = 00010 Carriage return is 00010, written 3 on this page as it was at Bletchley Park. Returns the carriage to the start of the line. One mark on the fourth impulse. Turn the tape over and it becomes line feed, and Wikipedia's Baudot article notes that page printers treat the pair the same in either order.
  • Figure shift = 11011 Figure shift is 11011, written 5 on this page as it was at Bletchley Park. Tells the receiving machine to print figures and punctuation until a letter shift arrives. Bletchley Park wrote it + or 5; this page uses 5. Flip all five impulses of a space and this is what comes out.
  • Letter shift = 11111 Letter shift is 11111, written 8 on this page as it was at Bletchley Park. All five marks. It returns the machine to letters, and on a punched tape it doubles as erase, since punching every hole overwrites whatever was there. Bletchley Park wrote it - or 8; this page uses 8. XOR with it flips every impulse of the other character.
  • Line feed = 01000 Line feed is 01000, written 4 on this page as it was at Bletchley Park. Moves the paper up one line. One mark on the second impulse, the mirror image of carriage return.
  • Null = 00000 Null is 00000, written / on this page as it was at Bletchley Park. No marks at all. Wikipedia's Baudot article records it as the idle code, sent when no message was passing. Any character XORed with itself gives null, so a / in the output means message and key held the same character at that place. A / inside a key leaves that character of the message unchanged.
  • Space = 00100 Space is 00100, written 9 on this page as it was at Bletchley Park. The gap between words, one mark in the middle. In XOR mode a space in the message is a real character with a key character of its own, which is why the 18-character example needs an 18-character key. It reads the same when the tape is turned over.

How this list was compiled: The 26 letter values are the convention A = 0 to Z = 25 with addition modulo 26, as used in the worked example of Wikipedia's article One-time pad (https://en.wikipedia.org/wiki/One-time_pad), whose example hello, XMCKL, EQNVZ and the second key TQURI giving later are asserted by the build script. The 32 five-bit codes, their mark counts and their figure-shift meanings in ITA2 and in the US teletype variant are the table International telegraphy alphabet No. 2 in Wikipedia's article Baudot code (https://en.wikipedia.org/wiki/Baudot_code); the build script parses the article's wikitext and asserts all 32 rows. The one-character names / 9 3 4 5 8 for the six codes that are not letters are the column BP shiftless interpretation in Wikipedia's article Cryptanalysis of the Lorenz cipher (https://en.wikipedia.org/wiki/Cryptanalysis_of_the_Lorenz_cipher), also parsed and asserted. The example A, B, G in plus and minus is from Wikipedia's article Gilbert Vernam (https://en.wikipedia.org/wiki/Gilbert_Vernam). The repeated-key example helloworld, key, rijvsuyvjn is from Wikipedia's article Vigenère cipher (https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher). All five articles were read on 2026-09-19. Every other example was written for this site and computed by script, with the keys drawn once from a random generator and frozen. Licence: own work; the three published examples named in the source line are quoted with credit from Wikipedia, and the opening of A Tale of Two Cities, used once as a key, is public domain