Skip to main content Accessibility Feedback

Building a Caesar Cipher with vanilla JS

Today, I’m back with another live-coding video.

Last week, I stumbled across a tutorial from Kirupa on building a Caesar Cipher with JavaScript. A Caesar Cipher is an old, super simple encryption algorithm that works by shifting each letter in a message a specific number of characters over to create a new message.

For example, shifting “hello” by one character results in “ifmmp”. The letter “i” is one character after “h”, “f” is one character after “e”, and so on. To decrypt the message, you shift it back the other way.

I wanted to try Kirupa’s project my own way. I also added a “multi-pass” feature that will encrypt the message multiple times to make it harder to decipher.

Watch me code this project.

You can find the source code on GitHub. And don’t forget to go read Kirupa’s original article for more background and details.