25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor

Create and solve substitution ciphers

On this page you can create and solve simple substitution ciphers. In a substitution cipher, each letter of the alphabet is replaced with a different letter.

A Caesar cipher is the simplest type of substitution cipher. Each letter of the alphabet is shifted by a fixed number of places. For example, with a shift of 1, every occurrence of the letter A becomes a B, every B becomes a C, and so on. The sequence "wraps around", so Z gets shifted to A. The reason this cipher is so simple is that in English there are only 25 possible ways to shift the alphabet, so it takes a maximum of 25 decoding attempts to find the original text. 

For example, using a Caesar cipher with a shift of 1, HELLO becomes IFMMP. With a shift of 2, it's JGNNQ.

Other substitution ciphers are more complicated and harder to decode. Every letter A-Z is replaced uniquely by some other letter A-Z, but it is done randomly, not by a simple shifting of the alphabet. You have to decode one letter at a time. 

The programs on this page are JavaScript translations of my original encoding and decoding programs for Microsoft Visual C++ and Borland C++.

The text you enter here is processed by your browser's JavaScript interpreter. It is not sent back to our website. We never see it.

However, this should be considered as nothing more than an entertaining game. Substitution ciphers, and Caesar ciphers in particular, offer almost no security at all. They are extremely easy to break and are best viewed only as fun puzzles.


Create a cipher

Enter your plain text here:


Read your ciphered text here:


Decode a cipher

Enter your enciphered text here:


To test for a Caesar cipher, Start Without Help, then click Rotate 26 times.
If that fails, Start With ETAOIN, which tries to assign the highest frequency letters to ETAOIN.

Letter frequencies in the ciphered text:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Decoded text, color coded to show locked letters, but in one long paragraph:

 

Decoded plain text, formatted same as the input:

Command Line. Enter the letters to change and click an action button below:

  

  • You can enter uppercase or lowercase letters. All are converted to upper case.
  • To change all T to E, enter TE in the box, then click Swap.
  • To lock the phrase THIS IS, enter THIS IS in the box, then click Lock. Duplicated letters don't matter.
  • Unlock works the same way.
  • Rotate is mostly for doing an initial Caesar Cipher test after Start Without Help. It can also help you get new ideas later in the decoding process, but be sure to click it 26 times in a row to get back where you started. Locked letters also rotate.
  • For security reasons, some characters in the input text are converted to dots (.) in the output.

Some ciphers to solve. Random difficulty. Copy and paste above. One of them is a Caesar cipher.

CQN UJF, RW RCB VJSNBCRL NZDJURCH,
OXAKRMB CQN ARLQ JB FNUU JB CQN YXXA,
CX BUNNY DWMNA KARMPNB,
CX KNP RW CQN BCANNCB,
JWM CX BCNJU KANJM.
WWAN, E MEM EU LHLEC.
E APLBZM VEUF BWID FZLDU, HWU PWNU EC UFZ HLSZ.
WF KLKB, KLKB,
WWAN, BWI UFECO E'S EC PWYZ,
UFLU E'S NZCU GDWS LKWYZ.
E'S CWU UFLU ECCWRZCU!
MXOXJJXS, IYP MXOXJJXS, IYP MXOXJJXS,
KJUUZN AY MFAN ZUMMC ZIKU RJXO PIC MX PIC,
MX MFU QINM NCQQILQU XR JUKXJPUP MAOU;
IYP IQQ XGJ CUNMUJPICN FIWU QAVFMUP RXXQN
MFU SIC MX PGNMC PUIMF. XGM, XGM, LJAUR KIYPQU!
QARU'N LGM I SIQEAYV NFIPXS, I ZXXJ ZQICUJ
MFIM NMJGMN IYP RJUMN FAN FXGJ GZXY MFU NMIVU
IYP MFUY AN FUIJP YX OXJU: AM AN I MIQU
MXQP LC IY APAXM, RGQQ XR NXGYP IYP RGJC,
NAVYARCAYV YXMFAYV.
SG PW, GH VGS SG PW: SKLS YI SKW AOWISYGV:
CKWSKWH 'SYI VGPZWH YV SKW MYVR SG IOFFWH
SKW IZYVNI LVR LHHGCI GF GOSHLNWGOI FGHSOVW,
GH SG SLXW L LHMI LNLYVIS L IWL GF SHGOPZWI,
LVR PU GBBGIYVN WVR SKWM. SG RYW: SG IZWWB;
VG MGHW; LVR PU L IZWWB SG ILU CW WVR
SKW KWLHSLJKW, LVR SKW SKGOILVR VLSOHLZ IKGJXI
SKLS FZWIK YI KWYH SG.
JTRFCYL KZBLKRZPULI YPBCYSCJY PFF BLJ ZJNMCZJXJTBY
KS BLJ EPTKTY KS ZJUMBPACFCBI
MTDJZ BLJ FPH KS EKTYUCEMKMY HPYBJ.
CB CY PZELPCE, EMXAZKMY, PTD CTJSSJEBCVJ;
CBY PENMCYCBCKT EKTYMXJY XMEL BCXJ PTD JSSKZB;
SPCFMZJ BK PENMCZJ CB CY JPYI KS DJBJEBCKT.
QVB AUZACBG HQFB ODIBG MIZC U GSQQVOJD QO CQVBT
ZCUV MIZC ZMBVZT AUGKG QO WIVBEUF.
MCT RQBG QVB MIGC ZQ AUZAC GQ HUVT ODIBG?
CUG QVB EQZ U SBZ OFQE?

 

 

Valid HTML 4.01 Transitional Valid CSS
View content labeling at ICRA.
Copyright ©2009 Steven Whitney. Last modified 10/24/2009.