An HTML file is a plain text document that tells your web browser what to display on a page
When you visit a website, your browser downloads an HTML file from a server. That file contains instructions written in a language called HTML — which stands for HyperText Markup Language. The browser reads those instructions and turns them into the page you see: text, images, links, buttons, and everything else on screen.
HTML files are just text. You could open one in Notepad or any text editor and read the raw code yourself. The file uses tags — words wrapped in angle brackets like <p> and <h1> — to mark up the content and tell the browser what each piece is. A tag that says <p> means "this is a paragraph." A tag that says <img> means "put an image here." The browser interprets those tags and renders the page accordingly.
HTML files almost always have the .html extension at the end of their filename, like index.html or contact.html. Some older systems use .htm instead, but both work the same way.
Key Takeaways
- An HTML file is a text document containing tags that instruct a web browser how to display content like text, images, and links.
- HTML stands for HyperText Markup Language, and tags are the instructions written inside angle brackets that structure the page.
- Every website you visit starts with an HTML file downloaded from a server to your browser.
- You can open and read an HTML file in any text editor, though it will look like code rather than a finished webpage.
- HTML files use the .html or .htm extension and work the same way across all modern web browsers.
How a browser turns HTML code into a webpage
When you type a web address into your browser or click a link, the browser sends a request to a web server asking for a file. The server sends back an HTML file. Your browser reads the file line by line, interprets each tag, and builds the page you see on screen.
For example, if the HTML file contains the code <h1>Welcome</h1>, the browser knows to display the word "Welcome" as a large heading. If it contains <a href="page2.html">Click here</a>, the browser creates a clickable link. The tags are invisible to you — you only see the result.
Modern websites also use CSS (a language that controls colors, fonts, and layout) and JavaScript (a language that makes things interactive). But HTML is always the foundation. CSS and JavaScript are either written inside the HTML file or linked to it, so the browser knows to load them too.
The basic structure of an HTML file
Every HTML file follows a similar structure. It starts with a declaration that tells the browser "this is HTML5" (the current version). Then it has a <head> section, which contains information about the page that visitors don't see, like the page title and links to CSS files. After that comes the <body> section, which holds all the content that actually appears on screen.
Inside the body, you'll find tags like <p> for paragraphs, <h1> through <h6> for headings of different sizes, <img> for images, and <a> for links. Each tag has an opening version (like <p>) and a closing version (like </p>). The content goes between them.
You don't need to memorize this structure to understand how websites work. The key point is that HTML is organized and predictable — every tag has a purpose, and the browser knows what to do with each one.
Where HTML files live and how they get to your computer
HTML files live on web servers — computers that run 24/7 and are connected to the internet. When you visit a website, you're not downloading a permanent copy to your computer. Instead, your browser requests the HTML file, the server sends it, your browser displays it, and then it's gone (though your browser may cache, or temporarily store, a copy for speed).
The main HTML file for a website is usually called index.html. When you visit a domain like www.example.com, the server automatically sends you index.html. If you visit www.example.com/about, the server sends you a different HTML file, often called about.html or something similar. Each page on a website is typically its own HTML file.
This is why websites can change. The HTML files on the server can be updated at any time. The next time you visit, you'll download the new version and see the changes.
Why HTML files are plain text
HTML files are plain text, not binary files like images or videos. This means you can open one in any text editor — Notepad on Windows, TextEdit on Mac, or any other program that handles text. You'll see all the code and tags written out.
This is actually useful. If you're curious about how a website is built, you can right-click on any webpage in your browser and select "View Page Source" or "Inspect." Your browser will show you the HTML code that makes up that page. You won't be able to edit it (the changes won't stick), but you can read it and learn how the page is structured.
Because HTML is plain text, HTML files are also very small compared to other file types. A page with hundreds of words might be only 50 kilobytes — tiny by modern standards. This is one reason websites load quickly.
The difference between an HTML file and a webpage
An HTML file is the code. A webpage is what you see in your browser. They're related but not the same thing. The HTML file is the ingredient list; the webpage is the finished meal.
When you save a webpage to your computer, you're usually saving the HTML file (and sometimes the images and other files that go with it). If you open that saved HTML file later, it will look similar to the original webpage, though some features might not work if they depend on a connection to the server.
This distinction matters because it explains why you can't edit a live website just by viewing it. The webpage you see is temporary — it's generated from the HTML file on the server each time you load the page. To change a website, someone has to edit the HTML file on the server itself.
Common file types that work alongside HTML
HTML files rarely work alone. Most websites also use CSS files (which control how things look) and JavaScript files (which make things interactive). Images, videos, and other media are stored separately and linked from the HTML file.
When your browser downloads an HTML file, it reads the code and sees references to other files. It then downloads those too. For example, the HTML might say "use the style.css file for colors and fonts" or "load this image from images/photo.jpg." The browser fetches all of these pieces and assembles them into the final page you see.
This modular approach makes websites easier to build and maintain. A designer can work on CSS while a programmer works on JavaScript, and they all connect through the HTML file.
Frequently Asked Questions
Can I edit an HTML file and change a website?
You can edit an HTML file on your own computer and open it in your browser to see the changes. But you cannot edit a live website this way — you only see the version stored on the server. To change a live website, you need access to the server files, usually through a hosting provider or content management system.
What happens if an HTML file has a mistake in the code?
Browsers are forgiving. If an HTML file has a typo or missing tag, the browser will usually still display something — it tries to guess what you meant and render the page anyway. This is why broken websites sometimes still look okay, even though the code isn't perfect.
Do I need to know HTML to use the internet?
No. Understanding how HTML works is helpful if you're building a website or curious about how the internet works, but it's not necessary to browse the web. Your browser handles all the HTML interpretation for you automatically.
Is HTML the same as a website?
No. HTML is the code language. A website is the complete package — HTML files, images, CSS styling, JavaScript interactivity, and the server that hosts it all. HTML is one piece of that puzzle.
Why do some websites have .html in the URL and others don't?
Modern web servers can hide the .html extension. A URL might show www.example.com/about even though the actual file is about.html. The server is configured to serve that file without showing the extension. This is just a cosmetic choice by the website builder.