diff --git a/editor/editor.js b/editor/editor.js
index 545ea6a..00b4c69 100644
--- a/editor/editor.js
+++ b/editor/editor.js
@@ -43,7 +43,7 @@ ${data["html"]}
 
 /* Return a link to view the page */
 function getViewLink(pageData) {
-  return `../#${window.btoa(encodeURIComponent(pageData))}`;
+  return `../#${window.btoa(pageData)}`;
 }
 
 
@@ -55,7 +55,7 @@ function update() {
     "html" : document.getElementById("html").value
   };
 
-  var html = getHTML(data);
+  var html = encodeURIComponent(getHTML(data));
 
   // Save encoded page data to the URL
   window.location.hash = "#" + window.btoa(JSON.stringify(data));
@@ -63,8 +63,11 @@ function update() {
   // Update the URL for the "Get Link" button
   document.getElementById("getLinkLink").href = getViewLink(html);
 
+  // Update the download link
+  document.getElementById("downloadLink").href = `data:text/html,${html}`
+
   // Update the <iframe> to display the generated page
-  window.frames[0].location.replace(`data:text/html,${encodeURIComponent(html)}`);
+  window.frames[0].location.replace(`data:text/html,${html}`);
 }
 
 /* Show a prompt with the HTML so the user can copy the code */
diff --git a/editor/index.html b/editor/index.html
index 16cf61f..30c7c6e 100644
--- a/editor/index.html
+++ b/editor/index.html
@@ -16,6 +16,7 @@
 <div id="buttons">
   <button><a id="getLinkLink" href="" target="_blank">Get Link</a></button>
   <button onclick="showCopyCodePrompt()">Copy Code</button>
+  <button><a id="downloadLink" href="" target="_blank" download="export.html">Download Code</a></button>
 </div>
 
 <iframe></iframe>