Standard / Reciprocal cipher
Beaufort cipher encoder and decoder
Transform text with the standard reciprocal Beaufort cipher using a repeating A-Z key.
01 / Workspace
Transform text
Enter 1 to 128 ASCII letters A-Z or a-z. Spaces, accents, digits, and punctuation are rejected.
ASCII letters consume key letters. The selected text handling rule controls case, spacing, punctuation, and other Unicode text.
Keyboard: press Ctrl+Enter or Command+Enter in the text or key field to transform.
Ready to transform.
02 / Result
Transformed text
Apply Transform again with the same key and handling mode to reverse the operation. Grouped mode restores only the normalized A-Z text.
03 / Convention
Standard Beaufort convention
Number A through Z as 0 through 25. For input value I and repeating key value K, this tool calculates output O = (K - I) mod 26. This is standard Beaufort, not Vigenere and not Variant Beaufort.
The operation is reciprocal: K - (K - I) = I mod 26. The same Transform action therefore encodes plaintext and decodes ciphertext.
Known-answer check
- Input
DEFENDTHEEASTWALLOFTHECASTLE- Key
FORTIFICATION- Output
CKMPVCPVWPIWUJOGIUAPVWRIWUUK
Character rules and limits
- Preserve formatting mode transforms ASCII A-Z and a-z only, retains each letter's case, and copies whitespace, punctuation, digits, accents, emoji, combining marks, and other scripts unchanged without consuming the key.
- Five-letter groups mode discards every non-ASCII letter before transforming, returns uppercase A-Z in groups of five, and cannot recover discarded characters or original case.
- Text is limited to 10,000 Unicode code points and 20,000 UTF-16 code units. The repeating key is limited to 128 ASCII letters. Invalid or over-limit input is rejected in full.
- JavaScript iterates text by Unicode code point, but it does not interpret grapheme clusters. Browser text fields normalize CR and CRLF line endings to LF.
- Processing stays in this page and adds no network requests or persistent storage. Copying occurs only when you choose Copy result.
- Beaufort is a classical cipher for education and puzzles. It is unsuitable for passwords, personal records, or any other sensitive information.