ROT13 encoder and decoder
ROT13 ("rotate by 13") replaces each letter with the one 13 positions further along the alphabet, wrapping from Z back to A. Because the English alphabet has 26 letters, rotating twice by 13 brings you back where you started. That makes ROT13 unusual: encoding and decoding are the same operation, and this tool needs only one button.
Example
The sample input mixes a plain question with an already encoded answer:
Why did the chicken cross the road? Gb trg gb gur bgure fvqr!
After Apply ROT13, the question becomes gibberish and the answer becomes readable:
Jul qvq gur puvpxra pebff gur ebnq? To get to the other side!
How the mapping works
| Plain | A B C D E F G H I J K L M |
|---|---|
| ROT13 | N O P Q R S T U V W X Y Z |
The second half of the alphabet maps back to the first half. Uppercase and lowercase letters keep their case. Digits, spaces, punctuation, emoji and accented letters such as é or ñ pass through unchanged, because only the 26 basic Latin letters are rotated.
ROT13 in code and editors
Because ROT13 is so simple, many tools have it built in:
- Shell:
echo 'Uryyb' | tr 'A-Za-z' 'N-ZA-Mn-za-m'prints "Hello". - Python:
codecs.encode('Hello', 'rot13'). - PHP:
str_rot13('Hello'). - Vim: the
g?operator rotates text, andg??rotates the current line. - Emacs:
M-x rot13-region.
If decoding leaves digits and punctuation scrambled, the text probably uses ROT47 instead. ROT47 rotates all printable ASCII characters from ! to ~ by 47 places, so numbers and symbols change too, and ROT13 cannot undo it.
What ROT13 is used for
ROT13 became popular on Usenet in the 1980s as a polite way to hide spoilers, joke punchlines and puzzle solutions. Readers had to take a deliberate step to see the text, but no key was needed. It is still used in forums, geocaching hints, programming exercises and as an easy first example of a substitution cipher.
ROT13 is not encryption
There is no secret involved, and anyone who recognizes the pattern can reverse it in seconds. Never use ROT13 to protect passwords, API keys or personal data. If you need to transport binary data as text, use Base64 encoding; if you need secrecy, use real cryptography such as AES.
Related ciphers
ROT13 is a Caesar cipher with a fixed shift of 13. To use any other shift, or to crack an unknown one automatically, open the Caesar cipher tool. For another self-inverse classic that mirrors the alphabet instead of rotating it, try the Atbash cipher.
Privacy
The conversion runs in your browser with a few lines of JavaScript. Nothing you type is sent to a server.