Beginner guides › Save and open an HTML file
How to save and open an HTML file
The AI has given you a block of code. Here's how to turn it into a file you can double-click, on Windows, Mac or Chromebook. It takes about two minutes, and you only need to learn it once.
An HTML file is just text with a special ending
A web page is plain text saved with .html at the end of its name. When you double-click a file ending in .html, your computer opens it in your web browser and runs it. That's all that's happening.
The only thing that trips people up is the editor quietly saving it as the wrong kind of file. The steps below avoid that.
On Windows, with Notepad
Copy the code
In the AI chat, click the Copy button on the code block. Check it ends with
</html>. If it doesn't, the reply was cut off: ask the AI to send the complete file again.Open Notepad and paste
Press the Windows key, type Notepad and press Enter. Paste with Ctrl+V.
Save as .html
- Choose File › Save as.
- Pick a folder you'll find again, such as Documents or Desktop.
- Set Save as type to All files (*.*).
- Type a name ending in .html, for example snake.html.
- Leave Encoding as UTF-8 and click Save.
Why "All files"? Without it, Notepad adds .txt and you get snake.html.txt, which opens as text instead of a page.Double-click to open it
Find the file in File Explorer and double-click it. It opens in your default browser (Edge, Chrome or Firefox).
On a Mac, with TextEdit
Switch TextEdit to plain text
Open TextEdit (press Cmd+Space and type TextEdit). Start a new document, then choose Format › Make Plain Text (or press Shift+Cmd+T). Do this before pasting.
Paste the code
Copy the code from the AI chat and paste it with Cmd+V.
Save as .html
Choose File › Save, type a name like snake.html and click Save. If TextEdit asks whether to use .html or .txt, choose Use .html.
Double-click to open it
Find the file in Finder and double-click it. It opens in Safari, or whichever browser you use.
One-time setting for later edits. In TextEdit go to TextEdit › Settings › Open and Save and tick Display HTML files as HTML code instead of formatted text. Then TextEdit shows you the code when you reopen the file.
On a Chromebook, with the Text app
Open the Text app
Open the Launcher and search for Text. If you don't have it, install the free Text app from the Chrome Web Store or Google Play.
Paste and save
Paste the code with Ctrl+V, then choose Save as. Save it in My files › Downloads with a name like snake.html.
Open it in Chrome
Open the Files app, find your file and double-click it. It opens in Chrome.
Updating your file
- Open your file in the editor. On Windows, right-click it and choose Open with › Notepad. On a Mac, right-click and choose Open With › TextEdit.
- Select everything (Ctrl+A, or Cmd+A on a Mac) and paste the new code over it.
- Save (Ctrl+S or Cmd+S).
- Go back to the browser tab and refresh (F5, or Cmd+R on a Mac).
Quick fixes
It opens as a page of code instead of the game or tool
The file was saved as .txt or as rich text. On Windows, check Save as type was All files. On a Mac, make sure you chose Format › Make Plain Text before saving. Then save it again with .html at the end.
I can't see whether the name ends in .html or .txt
Windows hides file endings by default. In File Explorer, choose View › Show › File name extensions (on Windows 10, tick File name extensions on the View tab). On a Mac, select the file and press Cmd+I to see its full name.
The page is blank
The code was probably cut off. It should finish with </html>. Ask the AI: "Your code was cut off. Please send the complete file again."
Strange symbols like ’ appear in the text
The file wasn't saved as UTF-8. Save it again and pick UTF-8 as the encoding, or ask the AI to add <meta charset="utf-8"> to the file.
It opens in the wrong program
Right-click the file and choose Open with, then pick your web browser. You can tick the option to always open .html files that way.
Can I do this on a phone or iPad?
Saving and editing is much easier on a computer. To use a finished project on your phone, put it online with free hosting and open the link.