Skip to content

ROT13 Encoder and Decoder

Updated:

Encode or decode ROT13 text online, with ROT5, ROT18 and ROT47 variants. Paste any text, choose the shift, and copy the converted result instantly.

Convert Text with ROT13, ROT5, ROT18 and ROT47

Input Fields
If enabled, the result will update automatically when you change any value.

ROT13 Formula

Formula
\[ E(x) = ((x - b + s) mod m) + b \]

Where:

  • \(x\) — character code position of the input letter (for example 0–25 within the alphabet)
  • \(b\) — base position of the alphabet block: 65 for A–Z or 97 for a–z in practice
  • \(s\) — shift amount: 13 for ROT13, 5 for digits in ROT5/ROT18, or 47 of the 94 printable ASCII positions for ROT47
  • \(m\) — modulus: 26 for letters, 10 for digits, 94 for printable ASCII

The formula rotates a character forward by \(s\) positions and wraps around at the end of its block. Because \(2 \times 13 = 26\), ROT13 applied twice returns the original text: \(E(E(x)) = x\). ROT5 and ROT47 satisfy the same self-inverse property with moduli 10 and 94.

ROT13 – Calculation Example

Example: using the default text The quick brown fox jumps over the lazy dog 123! with the ROT13 variant and letter case kept.

\[ T(19) -> (19 + 13) mod 26 = 6 = G \]

\[ h(7) -> (7 + 13) mod 26 = 20 = U \]

Result: Gur dhvpx oebja sbk whzcf bire gur ynml qbt 123! — the 35 letters are shifted, while digits, spaces, punctuation and the exclamation mark pass through unchanged for ROT13.

How to use the calculator

  1. Paste your text into Text to convert. It accepts letters, digits, spaces and punctuation; empty input is not converted.
  2. Choose Variant: ROT13 for letters only, ROT5 for digits only, ROT18 for letters and digits together, or ROT47 for every printable ASCII character from code 33 to 126.
  3. Leave Keep letter case checked to preserve uppercase and lowercase, or uncheck it to flatten letters to uppercase. This option does not change ROT47 behavior.
  4. Read Your ROT Result: a short summary, the converted text ready to copy, the substitution mapping, and notes on where ROT13 is used.
  5. To reverse the operation, paste the output back in and run the same variant again; these rotations are self-inverse.

What ROT13 is and why it matters

ROT13 is a Caesar-style substitution cipher that replaces each English letter with the letter 13 positions later in the alphabet. A becomes N, B becomes O, M becomes Z, and N becomes A again. It exists for gentle obfuscation, not for secrecy: it hides spoilers, punchlines and puzzle answers from casual scrolling while remaining trivial to read for anyone willing to run the same transformation.

The practical appeal is symmetry. Since 13 is exactly half of 26, encoding and decoding are the same action, so one button is enough. ROT5 applies the same idea to decimal digits using a half-cycle of 10, ROT18 combines both, and ROT47 extends the rotation across the 94 printable non-space ASCII characters, making the output less recognizable because letters, digits and symbols are all scrambled together.

Use the output as a polite warning label rather than a lock. If you need real confidentiality, hashing or encryption is required; see tools such as SHA-256 Hash for one-way fingerprints and Vigenère Cipher for a classic keyed cipher. For general text cleanup nearby, try Case Converter. ROT13 is closely related to the Caesar Cipher, where any shift can be chosen instead of the fixed half-alphabet shift.

Assumptions, limitations and practical tips

  • ROT13 is not encryption. Anyone with this page, Unix tr, or a moment of patience can reverse it, so never use it for passwords, personal data, keys or private messages.
  • ROT13, ROT5 and ROT18 preserve characters outside their target ranges. Spaces, accents, emoji, CJK characters and most punctuation pass through untouched; ROT47 changes printable ASCII 33–126 but still leaves spaces, tabs, newlines and non-ASCII text unchanged.
  • Letter case handling depends on the Keep letter case setting and on the variant. ROT47 treats uppercase and lowercase as distinct ASCII codes and ignores that checkbox.
  • The mapping is language-specific and alphabet-specific: ROT13 is designed around A–Z/a–z. Text in other writing systems needs a different tool.
  • For very large pastes, keep text under roughly 200,000 characters so browser rendering and the substitution table stay responsive.
  • If decoded text looks wrong, confirm you used the same variant used for encoding; ROT47 output cannot be undone by ROT13 and may include symbols that editors or terminals display unevenly.

Frequently Asked Questions

How do I encode or decode ROT13 by hand?

Write the alphabet A through Z, then pair A with N, B with O, and so on through M with Z; the same pairs work in reverse. To convert a word like CAT, shift each letter 13 places: C becomes P, A becomes N, T becomes G, giving PNG. For decoding, do exactly the same swap, because each letter's partner is the same in both directions. You do not need a different procedure to undo it.

Why does applying ROT13 twice restore the original text?

The English alphabet has 26 letters and ROT13 moves by exactly half that cycle, 13. A full cycle returns any letter to itself, so two half-cycles cancel out: shifting forward 13 and then forward 13 more equals 26, which is congruent to zero modulo 26. The same self-inverse logic holds for ROT5 over digits (5 + 5 = 10) and ROT47 over the 94 printable ASCII positions (47 + 47 = 94).

What is the practical difference between ROT13, ROT5, ROT18 and ROT47?

ROT13 rotates letters only and leaves digits and punctuation untouched. ROT5 rotates digits 0-9 only, leaving letters alone. ROT18 is simply both combined, so letters and digits are shifted together. ROT47 spreads the rotation across all printable ASCII codes 33-126, scrambling letters, digits and symbols alike. Choose based on what you want hidden: ROT13 for ordinary words, ROT18 when numbers matter too, and ROT47 for less recognizable-looking output.

Why does my ROT13 or ROT47 output decode into gibberish?

The usual cause is a mismatched variant: text scrambled with ROT47 cannot be restored by ROT13, and ROT18 will not correctly undo ROT13 on digits-only content. Another cause is case flattening or copied text that lost characters in transit, such as smart quotes or non-ASCII symbols being altered. Confirm the exact variant used to encode, paste the full output back unchanged, and check that remaining spaces and punctuation were not modified by an editor.

Is ROT13 safe for passwords or private messages?

No. ROT13 is an obfuscation toy, not a security control, and anyone can reverse it instantly with a chart or this same tool. Never use it for passwords, API keys, addresses, health details or anything confidential. It is fine for spoilers, puzzle answers and hiding punchlines from casual readers. For real protection use proper encryption or a strong one-way hash, plus a password manager for credentials.

Does ROT13 work on accented letters, emoji or other alphabets?

It is built for unaccented English A-Z and a-z only. Accented letters such as é, characters from Greek or Cyrillic, CJK ideographs, emoji and most symbols are outside the A-Z block and pass through unchanged under ROT13, ROT5 and ROT18. ROT47 handles printable ASCII punctuation and Latin letters but still leaves spaces, tabs, newlines and non-ASCII characters alone, so mixed-language text will only be partially transformed.

How is ROT13 related to the Caesar cipher?

ROT13 is a special case of the Caesar cipher, the classic substitution method that shifts every letter by a fixed number of positions. Julius Caesar reportedly used a shift of 3; ROT13 uses 13 because half the 26-letter alphabet makes encoding and decoding identical. A general Caesar cipher lets you pick any shift from 1 to 25, which is flexible but still trivially breakable by frequency analysis or brute force.

Leave a Reply

Your email address will not be published. Required fields are marked *