Vigenère cipher reference

Vigenère Cipher Practice Problems With Step-by-Step Answers

Reading a Vigenère example is not the same as being able to work one correctly.

The mistakes usually appear when the key repeats, arithmetic wraps around the alphabet, a negative decryption result has to be reduced modulo 26, or the text contains characters that do not consume key positions.

This practice set is designed to expose those points deliberately.

The exercises begin with individual letter arithmetic, move through complete encryption and decryption, then add key recovery, candidate-key testing, debugging, punctuation handling, and a longer challenge. The answers are separated from the questions so the page can be used as an actual worksheet rather than a list of examples to copy.

If you need a refresher before starting, see How to Encrypt and Decrypt With the Vigenère Cipher. If you want to check your own final result with a tool, use the Vigenère Cipher Decoder and Encoder.

Rules used for the exercises

Unless a problem explicitly says otherwise, use this standard A–Z convention:

A = 0
B = 1
C = 2
...
Z = 25

Encryption:

C = (P + K) mod 26

Decryption:

P = (C - K) mod 26

The key begins at the first plaintext or ciphertext letter and repeats as many times as necessary.

For the main exercises, use uppercase A–Z only. Spaces shown in restored answers are for readability and are not part of the encrypted letter stream.

Problem 11 deliberately uses a different, explicitly stated formatting rule.

Try the problems before opening the worked solutions.


Practice problems

Problem 1: Two single-letter calculations

1A. Encrypt one letter

Encrypt plaintext letter:

R

with key letter:

K

What ciphertext letter do you get?

1B. Decrypt one letter

Decrypt ciphertext letter:

B

with key letter:

F

What plaintext letter do you get?


Problem 2: Encrypt a short word

Encrypt:

CODE

with key:

MAP

Write out the repeated key and calculate the four ciphertext letters.


Problem 3: Decrypt a short ciphertext

Decrypt:

ZYXJPC

with key:

KEY

What plaintext does it produce?


Problem 4: Encrypt across several key cycles

Encrypt:

MEETATNOON

with key:

SUN

The plaintext is longer than the key, so key alignment matters.


Problem 5: Recognize the one-letter-key case

Decrypt:

JSHZZPJHS

with the one-letter key:

H

What plaintext is recovered?

What simpler classical cipher does this operation reduce to?


Problem 6: Track key positions correctly

Encrypt:

VIGENERECIPHER

with key:

KEY

Then answer a second question:

Which plaintext positions use key letter K?

Number the first plaintext letter as position 1.


Problem 7: Recover the key from plaintext and ciphertext

You know that:

Plaintext:  SECRET
Ciphertext: DMOVPB

The cipher is standard repeating-key Vigenère, and the fundamental key period is known to be 4.

Recover the four-letter key.


Problem 8: Choose the correct candidate key

The ciphertext is:

ZSVMHGRRPU

One of these four keys was used:

RIVER
STONE
LIGHT
NORTH

Decrypt the ciphertext under each candidate and identify the key that produces meaningful plaintext.


Problem 9: Find the student’s mistake

A student uses:

Plaintext: ABC
Key:       BBB

and reports:

Ciphertext: CDE

Under the standard convention used on this page, is that correct?

If not, what ciphertext should be produced, and what mistake most likely caused the student’s answer?


Problem 10: Do these two keys always behave the same?

Consider these keys:

DOG
DOGDOG

Under standard repeating-key Vigenère, will they produce the same ciphertext for every plaintext?

Explain why.


Problem 11: Practice punctuation and case alignment

For this problem only, use these rules:

Encrypt ASCII letters only.
Preserve the original case of each letter.
Copy spaces, digits, and punctuation unchanged.
Nonletters do not consume a key position.
The key is case-insensitive.

Encrypt:

Meet at 9!

with key:

KEY

Problem 12: Longer decryption challenge

Decrypt:

KVCVHZXIOTYVNTCMHVMRUVZVVV

with key:

VECTOR

After decrypting the normalized letters, restore sensible word spacing.


Step-by-step answers

Answer 1: Single-letter arithmetic

1A. Encrypt R with K

Convert the letters to numbers:

R = 17
K = 10

Add:

17 + 10 = 27

Reduce modulo 26:

27 mod 26 = 1

Convert 1 back to a letter:

1 = B

So:

R + K → B

Answer: B

This small example is useful because it crosses the Z boundary. Without modulo-26 wraparound, the result would not remain inside the alphabet.

1B. Decrypt B with F

Convert to numbers:

B = 1
F = 5

Subtract:

1 - 5 = -4

A negative intermediate result is not an error. Reduce it modulo 26:

-4 mod 26 = 22

Convert 22 back to a letter:

22 = W

Answer: W

The key lesson is that Vigenère decryption uses modular subtraction, not ordinary subtraction with negative values discarded.


Answer 2: CODE with key MAP

The key has three letters, while the plaintext has four.

Repeat the key:

Plaintext: C O D E
Key:       M A P M

Now calculate each position.

Position Plaintext Key Calculation Ciphertext
1 C = 2 M = 12 2 + 12 = 14 O
2 O = 14 A = 0 14 + 0 = 14 O
3 D = 3 P = 15 3 + 15 = 18 S
4 E = 4 M = 12 4 + 12 = 16 Q

So the ciphertext is:

OOSQ

Answer: OOSQ

Notice that the fourth letter returns to the first key letter M.


Answer 3: ZYXJPC with key KEY

Repeat the key:

Ciphertext: Z Y X J P C
Key:        K E Y K E Y

Decrypt with:

P = (C - K) mod 26
Position Ciphertext Key Calculation Plaintext
1 Z = 25 K = 10 25 – 10 = 15 P
2 Y = 24 E = 4 24 – 4 = 20 U
3 X = 23 Y = 24 -1 mod 26 = 25 Z
4 J = 9 K = 10 -1 mod 26 = 25 Z
5 P = 15 E = 4 15 – 4 = 11 L
6 C = 2 Y = 24 -22 mod 26 = 4 E

The result is:

PUZZLE

Answer: PUZZLE

This problem contains several negative subtraction results on purpose. Correct modular handling is essential during decryption.


Answer 4: MEETATNOON with key SUN

Repeat the three-letter key across all ten plaintext positions:

Plaintext: M E E T A T N O O N
Key:       S U N S U N S U N S

Now encrypt.

Plaintext Value Key Value Sum mod 26 Ciphertext
M 12 S 18 4 E
E 4 U 20 24 Y
E 4 N 13 17 R
T 19 S 18 11 L
A 0 U 20 20 U
T 19 N 13 6 G
N 13 S 18 5 F
O 14 U 20 8 I
O 14 N 13 1 B
N 13 S 18 5 F

So:

MEETATNOON + SUN → EYRLUGFIBF

Answer: EYRLUGFIBF

A useful self-check is to inspect positions 1, 4, 7, and 10. They all use S because the key period is 3.


Answer 5: One-letter key H

The key contains only one letter:

H = 7

So every ciphertext character is shifted backward by 7 during decryption.

Ciphertext: J S H Z Z P J H S
Key:        H H H H H H H H H
Plaintext:  C L A S S I C A L

Therefore:

JSHZZPJHS → CLASSICAL

Answer: CLASSICAL

A one-letter Vigenère key applies the same shift at every position. It is therefore equivalent to a Caesar cipher using that shift.

This is why a one-letter Vigenère key is a useful edge case when checking whether someone understands what the repeating key is actually doing.


Answer 6: VIGENERECIPHER with key KEY

The repeated key is:

Plaintext: V I G E N E R E C I P H E R
Key:       K E Y K E Y K E Y K E Y K E

Encryption produces:

FMEORCBIASTFOV

Ciphertext answer: FMEORCBIASTFOV

Now look at the key alignment:

Position:  1  2  3  4  5  6  7  8  9 10 11 12 13 14
Key:       K  E  Y  K  E  Y  K  E  Y  K  E  Y  K  E

K occurs at:

1, 4, 7, 10, 13

Position answer: 1, 4, 7, 10, and 13

The distance between those positions is the key period:

3

Answer 7: Recover the four-letter key

We know:

Plaintext:  S E C R E T
Ciphertext: D M O V P B

For standard Vigenère:

K = (C - P) mod 26

Calculate each position.

Position Plaintext Ciphertext Key calculation Recovered key letter
1 S = 18 D = 3 3 – 18 ≡ 11 L
2 E = 4 M = 12 12 – 4 = 8 I
3 C = 2 O = 14 14 – 2 = 12 M
4 R = 17 V = 21 21 – 17 = 4 E
5 E = 4 P = 15 15 – 4 = 11 L
6 T = 19 B = 1 1 – 19 ≡ 8 I

The recovered keystream segment is:

LIMELI

The problem tells us that the fundamental period is 4.

The first four letters are:

LIME

and positions 5 and 6 correctly repeat:

L I

So the key is:

LIME

Answer: LIME

This is a small exercise in the same algebra used by known-plaintext analysis. The dedicated known-plaintext attack guide covers the cryptanalytic implications in depth; here the purpose is simply to practice solving the Vigenère equation for K.


Answer 8: Test the four candidate keys

Ciphertext:

ZSVMHGRRPU

Try each candidate.

RIVER

IKAIQPJWLD

STONE

HZHZDOYDCQ

LIGHT

OKPFOVJLIB

NORTH

MEETATDAWN

Only one candidate produces coherent plaintext:

NORTH → MEETATDAWN

Restoring spaces:

MEET AT DAWN

Answer: key NORTH

This is not frequency analysis. The candidate set was supplied in advance, so the task is simply to test each proposed key and recognize the valid plaintext.


Answer 9: Diagnose ABC + BBB

The student reported:

CDE

Under the standard A=0 convention, that is wrong.

B represents shift 1.

So:

A + B = B
B + B = C
C + B = D

The correct result is:

BCD

Answer: BCD

The reported result CDE is what you would expect if the student mistakenly treated:

B = 2

instead of:

B = 1

That usually comes from using an A=1, B=2, ... mapping while still applying the standard additive formula.

The convention itself must stay internally consistent. For the standard Vigenère arithmetic used throughout this site, A=0.


Answer 10: DOG vs DOGDOG

Yes.

Under ordinary repeating-key Vigenère, both generate the same infinite keystream:

DOGDOGDOGDOGDOG...

For key DOG:

DOG | DOG | DOG | DOG ...

For key DOGDOG:

DOGDOG | DOGDOG | DOGDOG ...

Character by character, the shifts are identical.

So for every plaintext:

E(P, DOG) = E(P, DOGDOG)

Answer: yes, they always produce the same ciphertext under the stated repeating-key convention.

The written key lengths are 3 and 6, but both have the same fundamental period of 3.

That distinction becomes important in cryptanalysis because statistical methods respond to the repeating shift pattern, not merely to the number of characters typed into a key field.


Answer 11: Meet at 9! with preserved formatting

The special rules say that only letters consume key positions.

So the six plaintext letters are:

M e e t a t

and they receive:

K E Y K E Y

The space, digit, and exclamation mark are copied without advancing the key.

Calculate the letters:

M + K = W
e + E = i
e + Y = c
t + K = d
a + E = e
t + Y = r

Restore the unchanged nonletters in their original locations:

Wicd er 9!

Answer: Wicd er 9!

If the second word comes out differently, check whether the key was accidentally advanced by the space.

The important lesson is not that every Vigenère implementation must use this formatting policy. It is that both encryption and decryption must use the same explicitly defined policy.


Answer 12: Longer challenge

Ciphertext:

KVCVHZXIOTYVNTCMHVMRUVZVVV

Key:

VECTOR

Repeat the key across the ciphertext:

VECTORVECTORVECTORVECTORVE

Then subtract each key value from its corresponding ciphertext value modulo 26.

The normalized plaintext is:

PRACTICEMAKESPATTERNSCLEAR

Restore natural spacing:

PRACTICE MAKES PATTERNS CLEAR

Answer: PRACTICE MAKES PATTERNS CLEAR

A useful final check is to re-encrypt the recovered normalized plaintext with VECTOR. It must return:

KVCVHZXIOTYVNTCMHVMRUVZVVV

If it does not, at least one decryption position is wrong.


How to check your work without hiding mistakes

Using a decoder after attempting a problem is useful. Using it before attempting the problem removes most of the learning value.

A good self-check process is:

1. Write the repeated key.
2. Convert only the positions you need to numbers.
3. Perform the modular operation.
4. Convert back to letters.
5. Compare with the expected answer.
6. If wrong, locate the first position where your result diverges.

The first wrong position often reveals the exact type of mistake.

If everything is correct until a new key cycle begins, inspect key repetition.

If the error appears only near A or Z, inspect modular wraparound.

If decryption creates negative numbers and then fails, inspect the modulo operation.

If a mixed-format problem fails only after punctuation, inspect whether nonletters consumed key positions.

This is more useful than simply replacing your answer with the correct ciphertext.

A compact scoring guide

The twelve problems test different skills, so a useful score is based on the type of error rather than just the number correct.

Problems Main skill
1–3 Basic modular encryption and decryption
4–6 Repeating-key alignment
7–8 Reverse reasoning and candidate-key testing
9–10 Conceptual correctness and debugging
11 Formatting policy and key advancement
12 Complete multi-cycle decryption

If Problems 1–3 are difficult, revisit the basic arithmetic before moving into cryptanalysis.

If Problems 1–3 are easy but 4–6 fail, focus on key alignment rather than the formula itself.

If the arithmetic is correct but Problem 11 fails, the issue is probably text-handling policy, not Vigenère mathematics.

Practice and implementation testing are different jobs

This worksheet is designed to test your understanding.

If your goal is instead to determine whether a program, plugin, or calculator conforms to a specific Vigenère convention, use the site’s verified Vigenère test vectors. That resource contains known-answer fixtures, edge cases, machine-readable JSON, and implementation-focused invariants.

Keeping those two purposes separate matters.

A student needs problems that require reasoning before the answer is visible.

A software test suite needs fixed expected outputs that can be checked automatically.

The same cipher supports both tasks, but a good learning exercise and a good conformance fixture are not the same resource.

The skill these problems are building

Vigenère arithmetic is simple enough that errors can feel random when the real issue is usually one of four things:

letter-to-number mapping
key alignment
modulo-26 wraparound
text-normalization rules

Once those are controlled, encryption and decryption become predictable.

That is the point of the progression in this worksheet. The first problems isolate one operation at a time. The middle problems force the repeated key to matter. The later problems ask you to reverse the equation, recognize equivalent keystreams, and preserve alignment through real-looking text.

If you can solve all twelve problems and explain why each answer is correct, you have moved beyond following a Vigenère example. You understand the mechanics well enough to detect your own mistakes.


Written by Marcus Hale

Editorially reviewed by VigenereDecoder.com editorial team

Written by Marcus Hale

Editorially reviewed by VigenereDecoder.com editorial team

Similar Posts