encyclopegia.org

ROT13

ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the Latin alphabet.[src] It is a special case of the Caesar cipher which was developed in ancient Rome, and used by Julius Caesar in the 1st century BC (see timeline of cryptography).[src] ROT13 may be referred to as Rotate13, ROT-13, rotate by 13 places, or sometimes by its autonym EBG13.[src]

ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the Latin alphabet.[src] It is a special case of the Caesar cipher which was developed in ancient Rome, and used by Julius Caesar in the 1st century BC (see timeline of cryptography).[src] ROT13 may be referred to as Rotate13, ROT-13, rotate by 13 places, or sometimes by its autonym EBG13.[src] ==Description== Applying ROT13 to a piece of text requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the Latin alphabet, wrapping back to the beginning as necessary.[src] When encoding a message, A becomes N, B becomes O, and so on up to M, which becomes Z.[src] Then the sequence continues at the beginning of the alphabet: N becomes A, O becomes B, and so on to Z, which becomes M.[src] When decoding a message, the same substitution rules are applied, but this time on the ROT13 encrypted text.[src] Other characters, such as numbers, symbols, punctuation or whitespace, are left unchanged.[src] Because there are 26 letters in the basic Latin alphabet and 26 = 2 × 13, the ROT13 function is its own inverse: \mbox{ROT}_{13}(\mbox{ROT}_{13}(x))=x for any basic Latin-alphabet text x .[src] In other words, two successive applications of ROT13 restore the original text (in mathematics, this is sometimes called an involution; in cryptography, a reciprocal cipher).[src] The transformation can be done using a lookup table, such as the following: For example, in the following joke, the punchline has been obscured by ROT13: Why did the chicken cross the road?[src] Gb trg gb gur bgure fvqr![src] Transforming the entire text via ROT13 form, the answer to the joke is revealed: Jul qvq gur puvpxra pebff gur ebnq?[src] To get to the other side![src] A second application of ROT13 would restore the original.[src] ==Usage== ROT13 is not intended to be used where secrecy is of any concern—the use of a constant shift means that the encryption effectively has no key, and decryption requires no more knowledge than the fact that ROT13 is in use.[src] Even without this knowledge, the algorithm is easily broken through frequency analysis.[src] In the early 1980s, people used ROT13 in their messages on Usenet newsgroup servers.[src] They did this to hide potentially offensive jokes, or to obscure an answer to a puzzle or other spoiler, or to fool less sophisticated spambots .[src] ROT13 has been the subject of many jokes.[src] The 1989 International Obfuscated C Code Contest (IOCCC) included an entry by Brian Westley.[src] Westley's computer program can be encoded in ROT13 or reversed and still compiles correctly.[src] Its operation when executed is either to perform ROT13 encoding on, or to reverse, its input.[src] In December 1999, it was found that Netscape Communicator used ROT13 as part of an insecure scheme to store email passwords.[src] In 2001, Russian programmer Dimitry Sklyarov demonstrated that an eBook vendor, New Paradigm Research Group (NPRG), used ROT13 to encrypt their documents.[src] It has been speculated that NPRG may have mistaken the ROT13 toy example—provided with the Adobe eBook software development kit—for a serious encryption scheme.[src] Windows XP uses ROT13 on some of its registry keys.[src] ROT13 is also used in the Unix fortune program to conceal potentially offensive quotations.[src] Johann Bessler, an 18th-century clockmaker and constructor of perpetual motion machines, pointed out that ROT13 encodes his surname as Orffyre.[src] He used its latinised form, Orffyreus, as his pseudonym.[src] ROT13 is used in some online discussions that don't have spoiler functionality to avoid accidentally revealing secrets or plot points ==Word pairs== Some words will, when transformed with ROT13, produce another word.[src] Examples of seven-letter pairs in the English language are abjurer and nowhere, and Chechen and purpura.[src] Other examples of word pairs are shown in the table.[src] The pair gnat and tang is an example of words that are both ROT13 reciprocals and reversals.[src] ==Variants and combinations== ROT5 is a practice similar to ROT13 that applies to numeric digits (0 to 9).[src] ROT13 and ROT5 can be used together in the same message, sometimes called ROT18 (18 = 13 + 5) or ROT13.5.[src] ROT47 is a derivative of ROT13 which, in addition to enciphering the Latin alphabet, transforms numbers and common symbols.[src] Instead of using the sequence A–Z as the alphabet, ROT47 uses a larger set of characters from the common character encoding known as ASCII.[src] Specifically, the 7-bit printable characters, excluding space, from character 33 (!) through 126 (~), 94 in total, in the order of their ASCII codes, are rotated by 47 positions, without considering letter case.[src] For example, the character A is mapped to p, while a is mapped to 2.[src] The use of a larger alphabet produces a more thorough obfuscation than that of ROT13; for example, a telephone number such as +1-415-839-6885 is not obvious at first sight from the scrambled result Z`\c`d\gbh\eggd .[src] On the other hand, because ROT47 introduces numbers and symbols into the mix without discrimination, it is more immediately obvious that the text has been encoded.[src] Example: The Quick Brown Fox Jumps Over The Lazy Dog.[src] enciphers to %96 "F:4 AD ~G6C %96 {2KJ s@8] The GNU C library, a set of standard routines available for use in computer programming, contains a function— mem frob () —which has a similar purpose to ROT13, although it is intended for use with arbitrary binary data.[src] The function operates by combining each byte with the binary pattern 00101010 (decimal 42) using the exclusive or (XOR) operation.[src] This effects a simple XOR cipher.[src] Like ROT13, XOR (and therefore memfrob() ) is self-reciprocal, and provides a similar, virtually absent, level of security.[src] ==Implementation== $ # Map upper case A-Z to N-ZA-M and lower case a-z to n-za-m $ tr 'A-Za-z' 'N-ZA-Mn-za-m' and the string "The Quick Brown Fox Jumps Over The Lazy Dog" in ROT47: $ echo "The Quick Brown Fox Jumps Over The Lazy Dog" | tr '\!-~' 'P-~\!-O' > %96 "F:4 AD ~G6C %96 {2KJ s@8 function rot13(str) { const upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); const lower_case = "abcdefghijklmnopqrstuvwxyz".split(""); let result = ""; for (let i = 0; i >>> import codecs >>> print(codecs.encode("The Quick Brown Fox Jumps Over The Lazy Dog", "rot13")) Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt Without importing any libraries, the cipher can be done by creating a translation table manually: >>> def gen_rot13_table(func=lambda x: x): ...[src] for c in (ord("A"), ord("a")): ...[src] for i in range(26): ...[src] yield func(i + c), func((i + 13) % 26 + c) >>> table = dict(gen_rot13_table(chr)) >>> table {'A': 'N', 'B': 'O', 'C': 'P', 'D': 'Q', 'E': 'R', 'F': 'S', 'G': 'T', 'H': 'U', 'I': 'V', 'J': 'W', 'K': 'X', 'L': 'Y', 'M': 'Z', 'N': 'A', 'O': 'B', 'P': 'C', 'Q': 'D', 'R': 'E', 'S': 'F', 'T': 'G', 'U': 'H', 'V': 'I', 'W': 'J', 'X': 'K', 'Y': 'L', 'Z': 'M', 'a': 'n', 'b': 'o', 'c': 'p', 'd': 'q', 'e': 'r', 'f': 's', 'g': 't', 'h': 'u', 'i': 'v', 'j': 'w', 'k': 'x', 'l': 'y', 'm': 'z', 'n': 'a', 'o': 'b', 'p': 'c', 'q': 'd', 'r': 'e', 's': 'f', 't': 'g', 'u': 'h', 'v': 'i', 'w': 'j', 'x': 'k', 'y': 'l', 'z': 'm'} >>> >>> s = "Quartz glyph job vext cwm porshrop finks?!" >>> print("".join(table.get(c, c) for c in s)) Dhnegm tylcu wbo irkg pjz cbefuebc svaxf?![src] For Python 3, the method (with ) can be used: >>> x, y = zip(*gen_rot13_table(chr)) >>> .join(x) 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' >>> .join(y) 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm' >>> table = str.maketrans(.join(x), .join(y)) >>> table {65: 78, 66: 79, 67: 80, 68: 81, 69: 82, 70: 83, 71: 84, 72: 85, 73: 86, 74: 87, 75: 88, 76: 89, 77: 90, 78: 65, 79: 66, 80: 67, 81: 68, 82: 69, 83: 70, 84: 71, 85: 72, 86: 73, 87: 74, 88: 75, 89: 76, 90: 77, 97: 110, 98: 111, 99: 112, 100: 113, 101: 114, 102: 115, 103: 116, 104: 117, 105: 118, 106: 119, 107: 120, 108: 121, 109: 122, 110: 97, 111: 98, 112: 99, 113: 100, 114: 101, 115: 102, 116: 103, 117: 104, 118: 105, 119: 106, 120: 107, 121: 108, 122: 109} >>> >>> print(s.translate(table)) Dhnegm tylcu wbo irkg pjz cbefuebc svaxf?![src] ==See also== Cryptanalysis Atbash ==Notes== ==References==[src]

56 sentences · 56 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"ROT13." encyclopegia.org, 2026, https://encyclopegia.org/wiki/rot13. Accessed 26 November 2026.

Chicago

"ROT13." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/rot13.

APA

encyclopegia.org. (2026). ROT13. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/rot13

Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Extension:ROT13

stub · references available
CC BY-SA 4.0 · tier1-factual · https://en.wikipedia.org/w/index.php?oldid=1378384130 · 0.55 · snapshot rot13-076481-bfd84df77c006974 · QID Q666455

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.