Home › Developer Tools › Caesar Cipher

Caesar Cipher

Shift every letter of a message by a fixed number of places to encode it, or shift it back to decode it. Don't know the key? The brute-force table tries all 25 shifts and ranks them by how much the result looks like English.

Last updated:

Presets

Letter frequency

your text (input)typical English

Advertisement
Advertisement

How to use the Caesar Cipher

  1. Choose Encode or Decode at the top.
  2. Type or paste your text and set the shift (key). ROT13 and Shift 3 are one click away.
  3. Press Encode or Decode (the output also updates as you type) and copy the result.
  4. Crack an unknown message: press Brute-force All Shifts. The most likely plaintext is listed first; click Use to adopt that key.
  5. Check the frequency chart to see why a shift was chosen: English text peaks at E, T, A and O.

Caesar cipher formula

Number the letters A = 0, B = 1 … Z = 25. With a key k:

  • Encrypt: E(x) = (x + k) mod 26
  • Decrypt: D(x) = (x − k) mod 26

Worked example with k = 3: H (7) → (7 + 3) mod 26 = 10 = K; E → H; L → O; O → R. So HELLO becomes KHOOR. For Y (24): (24 + 3) mod 26 = 1 = B, which is how the alphabet wraps around. A negative key shifts the other way: decoding with key 3 is the same as encoding with key −3 or 23.

Shift table for a key of 3

PlainABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherDEFGHIJKLMNOPQRSTUVWXYZABC

How the brute force ranks the 25 shifts

For every key from 1 to 25 the tool decodes the text and scores the result:

  1. Letter frequencies. English uses E (12.7%), T (9.1%), A (8.2%) and O (7.5%) most and J, Q, X and Z least. The score adds up the log-probability of every letter, and the table also shows a chi-squared value: χ² = Σ (observed − expected)² ÷ expected.
  2. Common words. The share of letters that form words like the, and, of, to, is, you.
  3. Common trigrams such as THE, ING, AND and ION, which also work when the text has no spaces.

Example: Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj decodes with key 3 to "The quick brown fox jumps over the lazy dog", which wins clearly because it contains the words the and over and has a natural letter mix. Texts shorter than about a dozen letters can be ambiguous, so check the next few rows too.

Variants of the shift cipher

NameWhat it shiftsHow to get it here
Caesar (classic)Letters by 3Preset “Caesar (3)”
ROT13Letters by 13 (self-inverse)Preset “ROT13”
ROT1Letters by 1 (A→B)Preset “ROT1”
Digit shift0–9 by the key modulo 10 (key 5 = ROT5 on digits)Tick “Also shift digits”
VigenèreEach letter by a different key letterA Caesar cipher per position; not covered by this tool

Frequently asked questions

What is a Caesar cipher?

A substitution cipher in which each letter is replaced by the letter a fixed number of positions further down the alphabet, wrapping from Z back to A. Julius Caesar reportedly used a shift of 3, so A becomes D and HELLO becomes KHOOR.

How do I decode a Caesar cipher without the key?

There are only 25 possible keys, so try them all. The brute-force table does this instantly and ranks each result by how English it looks, using letter frequencies and common words. For a sentence or more, the correct key is almost always at the top.

What is ROT13?

ROT13 is a Caesar cipher with a shift of 13. Because the alphabet has 26 letters, applying ROT13 twice gives back the original text, so the same operation encodes and decodes. It is used to hide spoilers and puzzle answers, not for security.

Is the Caesar cipher secure?

No. With only 25 keys it can be broken by hand in minutes and by a computer instantly. It is useful for teaching, puzzles, escape rooms and geocaching, but never for protecting real information.

What happens to numbers, spaces and punctuation?

They are left unchanged, and the case of every letter is preserved. Tick “Also shift digits” to rotate 0–9 by the shift as well (modulo 10), which some puzzles use.

How does the English score work?

Each candidate is scored by comparing its letter frequencies with English (a chi-squared test) and by counting common English words such as the, and, of and to. The percentages show how the 25 candidates compare with each other.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Binary TranslatorConvert text to binary, hex, octal and back.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.Cryptogram MakerTurn any quote into a printable cryptogram puzzle with hints, letter frequencies and an answer key.Cryptogram PuzzleCrack a substitution cipher letter by letter to reveal a famous saying. Daily puzzle, hints, timer.Hidden Message EncoderHide a secret message inside normal text with invisible zero-width characters, and reveal it.Password GeneratorCreate strong passwords and passphrases.MD5 Hash GeneratorGenerate MD5 hashes of text, lines or files and verify checksums.SHA-256 Hash GeneratorSHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64.HTML Entity Encoder / DecoderEscape and unescape HTML entities, named or numeric.Bcrypt Hash Generator & CheckerCreate bcrypt password hashes and check a password against a hash.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.JWT DecoderDecode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures.JWT GeneratorCreate and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON Escape / UnescapeEscape text for a JSON string, unescape \n and \" back to text, or stringify a whole object.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.RSA Key GeneratorGenerate 2048, 3072 or 4096-bit RSA key pairs as PEM, PKCS#1, JWK or OpenSSH, locally.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.PGP Encrypt / DecryptEncrypt, decrypt, sign and verify PGP messages with your armored keys, entirely offline.PGP Key GeneratorGenerate an OpenPGP key pair (Curve25519, NIST ECC or RSA) with passphrase and expiry, offline.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.Self-Signed Certificate GeneratorCreate a self-signed SSL certificate and key for localhost or dev servers, as PEM or PFX.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SHA-512 Hash GeneratorSHA-512 and SHA-384 hashes of text or files in hex or Base64, HMAC and hash verification.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UTF-8 Encoder / DecoderConvert text to UTF-8 bytes in hex, decimal, binary, \x or % and decode bytes back to text.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.RSA Encryption ToolEncrypt text with an RSA public key and decrypt it with the private key using RSA-OAEP in your browser.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.Protobuf DecoderDecode raw Protocol Buffers hex or Base64 without a schema, or add a .proto for field names.
See all 65 Encoders, Hashes & Crypto →