How to Run HTML Code in Notepad Windows 11

Published by Nyau Wai Hoe - Updated on

HTML, which stands for Hyper Text Markup Language, is a type of standard language used for creating web pages. A HTML file basically describes the structure of a webpage. It can also include other technologies such as CSS (Cascading Style Sheets) which handles styling and designs for elements such as font, color, hyperlink, etc., and scripts such as JavaScript.

There are many types of app you can use to write HTML code on. You can code HTML in simple text editor such as Notepad in Windows, code editor, or web design software made specifically for HTML and other languages such as Adobe Dreamweaver.

If you prefer to code HTML by hand in Windows, you can quickly do so using only the preinstalled Notepad app in Windows. This guide will show you how to write and run HTML code in Notepad on Windows 11.

Also see: How to Recover Unsaved Notepad in Windows 11

Run HTML Code in Notepad on Windows 11

To run HTML code, you will need to save the code as .html so that web browsers can recognize the file as an HTML file type. If you have a set of HTML code you want to execute, you can write or paste the code in Notepad on Windows 11, and then save it as HTML format. You can then run the HTML file with a web browser to view the result of the codes.

Example – Write and Run HTML code in Notepad

First, open Notepad in Windows 11 and type or paste the HTML code you want to run in the notepad. You can use the sample HTML codes below as a reference.

    <title>HTML Sample Page Title</title>
    <h1>Run Simple HTML Code in Windows 11</h1>
      <a href="">Windows Digital</a> shows you how you can write and run HTML codes in Notepad on Windows 11.

How to Run HTML Code in Notepad Windows 11

Once you are done entering the HTML code you want to run in Notepad, click File and select Save as.

Save as HTML file Windows 11

Next, in the Save as window, type any file name you want, and change the .txt extension to .html instead. Then, click Save to save the file as an HTML file.

Run HTML Code in Notepad

If you save the file as a basic text file (.txt), the code inside will only be recognized as plain texts instead of executable HTML code. You need to properly save the code as HTML format in order for relevant software such as web browser to recognize it as an HTML document.

After saving the HTML file, you can run the file in any web browser you want, for example, Google Chrome or Mozilla Firefox. By default, Windows will automatically run any .html file with your default web browser when you double-click to open the file. To manually choose a browser to open the HTML file, right-click the file, select Open with and select the browser you want to use.

Open HTML file with Chrome

The output of the HTML codes will then be displayed in a new tab on the selected browser.

How to write HTML code in Notepad Windows 11

Edit an HTML file with Notepad

In addition, you can also edit any HTML file directly with Notepad. You don’t need to convert it back to .txt just to edit the HTML code in Notepad. To edit an existing .html file with Notepad, right-click the HTML file, select Open with, and then select Choose another app.

Open HTMl file with Notepad

When you are prompted to select an app to open the HTML file, scroll down and click More apps. Then, select Notepad and click OK to open the HTML file in Notepad.

Edit HTML file with Notepad Windows 11

Notepad will be able to open the HTML file and display the source code in it. You can then edit the HTML code as you wish. Once you have done editing, you can simply press Ctrl + S to save the file as the original file.

Categories: ComputingWindows 11

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link