Home / Encoding guides / Guide: what is ROT13

What Is ROT13?

A short guide to the simple letter-swapping cipher that people use to hide spoilers.

The idea

ROT13 stands for rotate by 13 places. Every letter is replaced by the letter 13 positions further along the alphabet, wrapping around at the end. It is a special case of the Caesar cipher, which can use any shift from 1 to 25.

A worked example

H e l l o   W o r l d
U r y y b   J b e y q

H moves to U, e to r, l to y, o to b, W to J, r to e and d to q. Only letters change. Spaces, digits and punctuation stay as they are.

Why it is reversible

With 26 letters, a shift of 13 is exactly half a turn. Doing it twice is a full turn, so ROT13 is its own inverse. That makes it unusually simple to use, because the same step encodes and decodes.

Where it is used

ROT13 became popular on early online discussion groups, where people used it to hide spoilers, punchlines and offensive jokes so that readers had to choose to reveal them. Today it still appears in puzzles, geocaching hints and simple programming exercises.

Not a secret code

ROT13 offers no real protection. There is no key, and anyone who knows the trick can read it. Never use it for passwords or sensitive data. For real protection, use proper encryption.

ROT13 in code

# Python
import codecs
print(codecs.encode("Hello, World!", "rot_13"))

// PHP
echo str_rot13("Hello, World!");

# Linux and macOS terminal
echo "Hello, World!" | tr 'A-Za-z' 'N-ZA-Mn-za-m'

Related schemes

  • ROT5: rotates the digits 0 to 9 by 5.
  • ROT18: ROT13 for letters plus ROT5 for digits.
  • ROT47: rotates the printable ASCII characters from ! to ~ by 47.

Try it in the ROT13 encoder, decode with the ROT13 decoder, or convert whole files with the batch converter.

Try it. Encode or decode any text with ROT13 in your browser.

Open the ROT13 encoder

Frequently asked questions

What does ROT13 stand for?

Rotate by 13 places. Each letter is moved 13 positions along the alphabet.

Who uses ROT13?

People who want to hide spoilers or puzzle answers from a casual glance, and programmers learning about ciphers.

What is the difference between ROT13 and a Caesar cipher?

ROT13 is a Caesar cipher with a fixed shift of 13. A Caesar cipher can use any shift.

Is ROT13 encryption?

No. It is obfuscation. Anyone can reverse it without a key.