This site works best with JavaScript enabled!

# Description: Text Converter - ROT Encryption

With ROT encryption, texts can be made unreadable at first glance. How this works and what the Online Converter from this platform all can do, you will find out here.

## Short Description

With this converter you can encrypt and decrypt an input text with ROT Ciphers.

## What exactly is ROT encryption?

ROT encryption, also called shift cipher, is basically no proper encryption (at least not secure), but nowadays only serves to make a text unreadable at first glance, so that an action of the reader is required to read the encrypted text. In principle, only the relevant characters are replaced by others by rotating the characters by a desired number of positions in the character alphabet.

## What can this ROT converter do?

With the help of this ROT converter you can not only generate the most popular ciphers ROT5, ROT13, ROT18 and ROT47, but also any other rotation of letters and/or numbers. There are three different methods: letters, numbers and ASCII.

### ROT Cipher Letters

In this method, all 26 letters in upper and lower case (A-Z, a-z) are replaced by the letters rotated in the alphabet. All other characters remain unchanged. For example, in the case of ROT1, the letters are rotated by one position, that means "a" ⇒ "b", "b" ⇒ "c", ..., "z" ⇒ "a", "A" ⇒ "B", "B" ⇒ "C", ..., "Z" ⇒ "A". In ROT2, the letters are rotated by two positions etc. Decryption is done either by rotation in the opposite direction or by rotation in the original direction with the value: $$26-\text{ROTATIONVALUE}$$

For ROT1 this means that the decryption is done either by rotating back by one position or by normal rotation by 25 positions.

A special case is ROT13, which is also known as Caesar cipher. When we calculate in this case, how many positions we have to rotate to decrypt an encrypted text, we get $$26-13=13$$. This means that exactly the same algorithm can be used for encryption and decryption.

For all those of you who would like to know how this can be programmed, here is the PHP code. With the help of the callback function preg_replace_callback() you can implement this in two lines:

1
2
$temp = preg_replace_callback("#[A-Z]#u", function ($matches) use($rotation) {return chr(((ord($matches[0]) - 65 + $rotation) % 26) + 65);},$input_text);
$output = preg_replace_callback("#[a-z]#u", function ($matches) use($rotation) {return chr(((ord($matches[0]) - 97 + $rotation) % 26) + 97);},$temp);

### ROT Cipher Numbers

The encryption is done similar to the encryption of the letters, but with the difference that only the 10 numbers (0-9) are rotated. The special case here is ROT5 (analogous to ROT13 in the case of letters), which makes this to the most used ROT method for numbers. The encryption of numbers and letters can of course also be combined. Best known for this is ROT18, which combines ROT13 for letters with ROT5 for numbers.

Here is the implementation of the ROT number encryption:

1
$output = preg_replace_callback("#[0-9]#u", function ($matches) use($rotation) {return ((int)$matches[0] + $rotation) % 10;},$input_text);

### ROT Cipher ASCII

The already known principle of ROT ciphering can also be applied to all printable ASCII characters. With ROT47, all 94 ASCII characters with the values 33 to 126 are rotated by 47 positions:

1
$output = preg_replace_callback("#[!-~]#u", function ($matches) {return chr(((ord($matches[0]) - 33 + 47) % 94) + 33);},$input_text);