This article was co-authored by wikiHow staff writer, Hannah Dillon. Hannah Dillon is a Technology Writer and Editor at wikiHow. She graduated with a B.A. in Journalism from North Dakota State University in 2013 and has since worked in the video game industry as well as a few newspapers. From a young age Hannah has cultivated a love for writing and technology, and hopes to use these passions in tandem to help others in the articles she writes for wikiHow.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 699,371 times.
Learn more...
HTML (Hypertext Markup Language) is a web-based coding language known as a "markup language." It's mainly used to create the structure of websites. In this article, we'll teach you how to save your HTML file and open it in your browser (as all modern browsers are capable of opening and interpreting .html files), as well as how to run your HTML code in an online code viewer or through FTP (or File Transfer Protocol).
Running an HTML File
- Right-click your HTML file, select Open with, and select a web browser. Your browser will run the file and interpret your code.
- Upload your file to an online HTML viewer to see the code and changes you make in real time.
- Use an FTP client to upload an HTML file to your website, then visit the website in your browser.
Steps
Saving an HTML File
-
Understand HTML. HTML files are text files that represent the content and the layout of a web page. To read an HTML file, you can use any text editor (e.g., Notepad, Notepad++, or any specialized HTML editor). However, if you want to see what the web page looks like, you need to run it on a web browser, which is designed to read and render HTML files.
- If you just want to run an HTML file you downloaded from somewhere else, skip down to Running in a Browser.
-
Write or copy HTML into a basic text editor. As you become a more proficient coder, you can use HTML editing programs like Adobe Dreamweaver, CoffeeCup, and Visual Studio Code, but a simple program is all you need to start. Notepad (Windows) or TextEdit (Mac) should suffice.Advertisement
-
Save the file as your-file.html. If you make an HTML file in Notepad, TextEdit, or any other text editor, be sure to save it with the proper notation. Before saving the file, make sure that you have changed your "Save as type" to All files (if needed) and click Save.
Running in an Online Viewer
-
Navigate to an online HTML viewer. There are a number of websites that allow you to view your HTML files. Try one of these options:
- HTML Online Viewer allows you to upload an HTML file, or you can copy and paste your raw HTML into the website's text editor. The pane on the right side of the page updates in real time to show you your HTML and any changes you make.
- Code Beautify also allows you to upload an HTML file or copy and paste your code into the webpage, and it also shows you your code interpreted in real time. However, unlike HTML Online Viewer, this website will "beautify" (or format) your HTML code so it's easy to read.
- Phoenix Code is an online IDE (or integrated development environment) that allows you to code your HTML online and view it in real-time. This IDE is quite powerful, as it allows you to create CSS and JS files to go with your HTML.
- Codepen is another online development environment that allows you to code in HTML, CSS, and JavaScript. You can easily save your code (called "pens") and share it with other people.
-
Upload your HTML file. If the site you chose has a button to import files, click that and navigate to your HTML file. Otherwise, simply copy and paste your HTML into the site's text editor.
-
View your interpreted code. If the site you're using doesn't update automatically, click the button to view it (which might say View or Run). You can then go back and edit your code as needed if you want to tweak something.
Running via FTP
-
Connect to your remote server (your website's server). If you're using the built-in platform, you don't need to worry about this. You'll usually see two boxes on the left and two boxes on the right. Don't worry about the left or top right ones; all you need to focus on is the bottom right box.
-
Locate your HTML file and drag it into the box. It will start the upload right away. If you're using the built-in platform, find and locate the "htdocs," "public_html," or other default HTML folder (check with your web host if you're unsure), and click Upload.[2]
- Don't use the shortcut! This will upload the LNK Mirror file, which you don't want.
-
View your HTML code in a web browser. Wait until the file is uploaded. Then, if you've removed the default page, go and view your website to see your HTML file! If you see a directory listing, click the .html file to view.
Community Q&A
-
QuestionHow do I run the HTML code from the notepad?Community AnswerSave the file as an HTML file type. Then, open the file and it should open in a browser.
-
QuestionHow do I open the file in Notepad again after opening it in the browser?Community AnswerDo the opposite of what you did to make it an html file. Save it as index.txt from index.html.
-
QuestionHow do I run an HTML program using Chrome?Community AnswerFirst, save the program on your desktop with an extension ".html," then right click on the file document and click on open with Chrome.