ROT13 Cipher API: The Complete Guide

Need to encode or decode ROT13 text in your application? This guide covers everything you need to know about the ROT13 cipher via API, including how it works, common use cases, and implementation examples.

What is ROT13?

ROT13 ("rotate by 13 places") is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet. It's a special case of the Caesar cipher. Since the alphabet has 26 letters, applying ROT13 twice returns the original text.

Example: Hello becomes Uryyb

How ROT13 Works

ROT13 is beautifully simple:

Letter Substitution

Each letter is replaced by the letter 13 positions after it: A becomes N, B becomes O, etc.

Self-Inverse

Since there are 26 letters, ROT13 is its own inverse. Encoding and decoding use the same operation.

Preserves Non-Letters

Numbers, spaces, and punctuation remain unchanged.

Not Encryption: ROT13 is not a secure encryption method. It's used for obscuring text, not protecting secrets.

Using the ROT13 API

TinyFn provides a simple endpoint for ROT13:

API Request
POST https://api.tinyfn.io/v1/cipher/rot13
Headers: X-API-Key: your-api-key
Content-Type: application/json

{
  "text": "Hello, World!"
}
Response
{
  "result": "Uryyb, Jbeyq!",
  "original": "Hello, World!"
}

Parameters

Parameter Type Description
text string Text to encode/decode (required)

Code Examples

JavaScript / Node.js

const response = await fetch('https://api.tinyfn.io/v1/cipher/rot13', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ text: 'Hello, World!' })
});
const result = await response.json();
console.log(result.result); // "Uryyb, Jbeyq!"

Python

import requests

response = requests.post(
    'https://api.tinyfn.io/v1/cipher/rot13',
    json={'text': 'Hello, World!'},
    headers={'X-API-Key': 'your-api-key'}
)
result = response.json()
print(result['result'])  # "Uryyb, Jbeyq!"

cURL

curl -X POST "https://api.tinyfn.io/v1/cipher/rot13" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, World!"}'

Common Use Cases

  • Spoiler Hiding: Obscure spoilers in text that readers can decode
  • Puzzle Games: Simple text puzzles and challenges
  • Email Obfuscation: Hide email addresses from simple scrapers
  • Usenet Tradition: Classic method for hiding offensive content
  • Educational: Teaching basic cryptography concepts

Best Practices

  1. Never use for security: ROT13 provides no cryptographic security
  2. Preserve formatting: Keep spaces and punctuation for readability
  3. Handle unicode: Be aware that ROT13 only affects A-Z letters
  4. Document usage: Make it clear when content is ROT13 encoded

Try the ROT13 API

Get your free API key and start encoding text in seconds.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key