Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en">
	<meta charset="UTF-8">
	<title>Caesar shift cipher</title>
	<link rel="stylesheet" type="text/css" href="style.css">
	<h1>Caesar Shift Cipher DEMO 1</h1>
	<p>"<span id="encrypted"></span>"</p>

	<button id="decrypt-button">Decrypt</button>

	<p id="decrypted"></p>

	<script src="cipher.js"></script>



                body {
  text-align: center;

h1 {
  font-size: 48px;

p {
  font-size: 48px;



                var caesarShift = function(str, amount) {

	// Wrap the amount
	if (amount < 0)
		return caesarShift(str, amount + 26);

	// Make an output variable
	var output = '';

	// Go through each character
	for (var i = 0; i < str.length; i ++) {

		// Get the character we'll be appending
		var c = str[i];

		// If it's a letter...
		if (c.match(/[a-z]/i)) {

			// Get its code
			var code = str.charCodeAt(i);

			// Uppercase letters
			if ((code >= 65) && (code <= 90))
				c = String.fromCharCode(((code - 65 + amount) % 26) + 65);

			// Lowercase letters
			else if ((code >= 97) && (code <= 122))
				c = String.fromCharCode(((code - 97 + amount) % 26) + 97);


		// Append
		output += c;


	return output;


// encrypt
var encrypted = caesarShift('blockchain', 3);
document.getElementById('encrypted').innerHTML = encrypted;

// decrypt
var decrypted = caesarShift('eorfnfkdlq', -3);
document.getElementById('decrypted').style.visibility = "hidden"

document.getElementById('decrypt-button').addEventListener('click', function(){
	document.getElementById('decrypted').style.visibility = "visible"
	document.getElementById('decrypted').innerHTML = decrypted;