Polyalphabetic Cipher

Running Key Cipher
Encoder & Decoder

Encrypt and decrypt messages using a full-length key text — the most secure classical polyalphabetic cipher. No server uploads. 100% client-side processing.

No data sent to server Real-time processing Step-by-step trace Supports Unicode letters
0 chars
0 chars
Alphabet:
Output
Your result will appear here…
Step-by-Step Transformation (first 40 alphabetic characters)
#PositionPlainKey P#K# OperationCipher
Why use this tool

Advanced Features Built for Cryptographers

Everything you need to work with the Running Key Cipher — in one free, fast tool.

Step-by-Step Trace

See exactly how each letter is transformed — plaintext position, key position, arithmetic operation, and output character — in a readable table.

Frequency Analysis

Built-in letter frequency analyser to study ciphertext patterns, compare to English letter distribution, and identify key weaknesses.

Dual Alphabet Modes

Standard A–Z (26-character) or extended alphanumeric A–Z plus 0–9 (36-character) alphabet for encoding numeric data as well.

Case & Spacing Control

Toggle case preservation and decide whether to keep or strip spaces and punctuation — giving you full control over output formatting.

100% Client-Side

Your message and key never leave your browser. Processing is entirely local — no servers, no logs, no tracking of your plaintext data.

Download Output

Export encrypted or decrypted results as a .txt file with one click — perfect for saving or sharing securely outside the browser.

How it works

Running Key Cipher in 4 Steps

The cipher uses standard modular arithmetic on letter positions — simple yet powerful.

1

Enter Your Message

Type or paste the text you want to encrypt (plaintext) or decrypt (ciphertext) into the input area.

2

Provide a Running Key

Enter a key text that is at least as long as your message. This can be a book passage, poem, or any long text.

3

Choose Options

Select your alphabet (A–Z or alphanumeric), toggle case preservation, and decide how to handle spaces and punctuation.

4

Encrypt or Decrypt

Click Encrypt or Decrypt. View the result, copy it, or download it. Enable step-by-step trace to see each character transformation.

What is the Running Key Cipher?

The Running Key Cipher is a classical polyalphabetic substitution cipher that solves the primary weakness of shorter-key ciphers: key repetition. Instead of cycling a short keyword across the plaintext, it uses a key that is as long as — or longer than — the message itself, drawn from a meaningful text source such as a book, newspaper article, or poem. This eliminates the periodic pattern that frequency analysts exploit in ciphers like Vigenère, making the Running Key Cipher significantly harder to crack without knowledge of the key source.

Running Key Cipher Algorithm

The cipher works through modular arithmetic on letter positions. Each plaintext letter is assigned a numerical value (A=0, B=1, … Z=25). The corresponding key character is similarly mapped. To encrypt, the two values are added and the result taken modulo 26 (for a 26-letter alphabet). To decrypt, the key value is subtracted from the ciphertext value, and modulo 26 is applied again to keep the result within range.

  • Encryption: C = (P + K) mod 26
  • Decryption: P = (C − K + 26) mod 26
  • Non-alphabetic characters are typically skipped or passed through unchanged depending on settings.

Running Key Cipher vs. Vigenère Cipher

Both ciphers share the same fundamental arithmetic, but differ critically in key structure. The Vigenère Cipher uses a short keyword that repeats cyclically — creating predictable periodic patterns that the Kasiski test and index-of-coincidence methods expose. The Running Key Cipher eliminates this cycle by using a non-repeating key of full message length. However, both can be attacked if the key source is guessable: with Running Key, an attacker can try common books and passages to find a plausible plaintext.

Historical Background & Use Cases

The Running Key Cipher was notably used by field agents who would pre-agree on a key book — both sender and receiver needed a copy of the same text to communicate. Its security depended on the secrecy of the key source, not the algorithm itself (Kerckhoffs's principle). Today it serves as an excellent educational tool for understanding polyalphabetic encryption, and this online Running Key Cipher encoder lets students, cryptographers, and puzzle enthusiasts explore it interactively.

  • Educational demonstrations of classical cryptography
  • Puzzle creation (escape rooms, ARG challenges, treasure hunts)
  • Competitive cryptanalysis and CTF (Capture the Flag) challenges
  • Historical codebreaking research and museum exhibits
  • Teaching modular arithmetic and group theory in cipher context

Is the Running Key Cipher Secure Today?

No modern application should rely on the Running Key Cipher for sensitive security. While its full-length key is a strength, practical security depends on keeping the key source completely secret and avoiding predictable texts. Modern symmetric encryption algorithms like AES-256 provide mathematically provable security levels that classical ciphers cannot match. Use this tool for learning, historical exploration, and creative projects — not for protecting sensitive information.

How to Decode a Running Key Cipher

Decoding requires the same key text used during encryption. Align the ciphertext with the key text character-by-character (skipping non-alphabetic characters based on your settings). For each pair, subtract the key letter's index from the ciphertext letter's index, add 26 if the result is negative, and take modulo 26 to get the plaintext letter's index. Our Running Key Cipher decoder automates this entire process — just paste your ciphertext and key, switch to Decrypt mode, and click the button.

FAQ

Frequently Asked Questions

A Running Key Cipher is a polyalphabetic substitution cipher where the encryption key is as long as the plaintext, typically derived from a book, article, or poem. It uses modular arithmetic (C = (P + K) mod 26) to transform each character, eliminating the periodic repetition found in shorter-key ciphers like Vigenère.
Both use the same addition formula, but Vigenère repeats a short keyword cyclically (creating exploitable periodic patterns), while the Running Key Cipher uses a non-repeating key as long as the message. This makes the Running Key Cipher immune to Kasiski examination and index-of-coincidence attacks that break Vigenère.
Not for serious security purposes. While stronger than simple substitution ciphers, it can be broken by mutual-key analysis if the key source (e.g., a specific book) is guessable. Modern encryption like AES-256 or RSA offers mathematically proven security. Use the Running Key Cipher for education, puzzles, and historical study only.
A good Running Key should be at least as long as your plaintext, drawn from a source both sender and receiver can access (like a specific book and page), and should not be easily guessable by a third party. For educational use, any passage works — for stronger security analogy, choose obscure or private texts.
Cryptanalytic decryption without the key is extremely difficult. For any given ciphertext, many different keys would produce English-looking plaintexts, making brute force infeasible. An attacker would need to identify the key source through other means. Without the key, you cannot reliably recover the original message.
By default, spaces and punctuation are passed through unchanged and key characters are only consumed for alphabetic plaintext characters. In extended mode (A–Z + 0–9), digits are also included in the cipher alphabet. The "Keep spaces/punctuation" toggle controls whether non-alpha characters appear in the output as-is.
The step-by-step trace table shows each alphabetic character: its position in the text, the plaintext letter, the key letter, their numerical values, the modular arithmetic operation performed, and the resulting output character. It's an educational feature that makes the cipher's mechanics fully transparent — up to the first 40 characters.

Explore More Cryptography Tools

Discover our full suite of cipher tools, encoders, and decoders — all free, all client-side, all in one place.

Copied!