Codec lesson · ROT13

ROT13: one alphabet, shifted halfway around

ROT13 rotates each Latin letter by 13 places. Because the English alphabet has 26 letters, the same operation both encodes and decodes.

Convention Round trip: Exact because ROT13 is its own inverse.
Learning objective

ROT13 rotates each Latin letter by 13 places. Because the English alphabet has 26 letters, the same operation both encodes and decodes.

A becomes N, B becomes O, and N wraps back to A. Uppercase and lowercase stay in their own ranges. Digits, punctuation, emoji, and non-ASCII letters stay unchanged; ASCII letters inside Vietnamese text still rotate.

01

How Encode Keyboard handles it

1

Find a Latin letter

Only A–Z and a–z enter the rotation.

2

Move 13 positions

The shift wraps around at the end of the alphabet.

3

Apply again to restore

Two half-alphabet rotations equal one full 26-letter cycle.

02

Worked example

InputHello, world!
OutputUryyb, jbeyq!

Punctuation stays put. Running ROT13 again restores the original exactly.

03

Good uses

  • Lightweight word puzzles
  • Hiding spoilers at a glance
  • Learning substitution ciphers
04

Validation and common errors

  • Only basic Latin letters change
  • Letter frequency and structure remain obvious
  • Every ROT13 reader can reverse it instantly
05

Practice in your browser

This uses the same documented rules as the app and runs only in this tab.

ROT13This uses the same documented rules as the app and runs only in this tab.
Result

This uses the same documented rules as the app and runs only in this tab.

06

Knowledge check

Why does applying ROT13 twice restore the original?