An HTM file is a plain text document that tells a web browser how to display a webpage
HTM and HTML are the same thing — both are text files that contain instructions written in a language called HyperText Markup Language. The only difference is the file extension: HTM uses three letters, HTML uses four. Browsers treat them identically. When you visit a website, your browser downloads an HTM or HTML file, reads the instructions inside it, and renders the page you see on your screen.
The file itself is just text. You could open it in Notepad, Word, or any text editor and read the raw code. What makes it special is that it contains tags — words wrapped in angle brackets like <p> and <h1> — that tell the browser what each piece of content is and how to display it. A tag that says <strong> tells the browser to make text bold. A tag that says <img> tells the browser to load and display an image file.
Key Takeaways
- HTM and HTML files are plain text documents containing instructions that browsers read and convert into the webpages you see.
- The three-letter HTM extension and four-letter HTML extension are functionally identical; the difference is purely historical.
- HTM files contain tags — words in angle brackets — that tell a browser what content is and how to format it.
- You can open and edit an HTM file in any text editor, though you need to save it with the correct extension for a browser to read it as a webpage.
- HTM files often reference other files like CSS stylesheets and JavaScript files that control how the page looks and behaves.
Why HTM instead of HTML
The HTM extension exists because of an old technical limitation. In the 1990s, some operating systems — particularly older versions of Windows — only allowed file extensions to be three letters long. Web developers had to choose between HTM and HTML, and many chose HTM to stay compatible with those systems. Modern systems have no such limit, so HTML became the standard, but HTM files still work everywhere.
You will encounter both extensions on the internet. Some websites use HTM, others use HTML. Some servers treat them differently for technical reasons, but from a browser's perspective, they are interchangeable. If you are creating a new webpage, HTML is the modern convention, but either will work.
What's actually inside an HTM file
An HTM file is structured as a series of nested tags. A basic example might look like this:
<html> <head> <title>My Webpage</title> </head> <body> <h1>Welcome</h1> <p>This is a paragraph.</p> </body> </html>
The <html> tag wraps the entire document. The <head> section contains metadata — information about the page itself, like its title, which appears in the browser tab. The <body> section contains the actual content the visitor sees. Tags like <h1> (heading), <p> (paragraph), and <img> (image) describe what each piece of content is.
Every opening tag like <p> needs a closing tag like </p>. The browser uses these pairs to understand where one piece of content ends and another begins. Some tags, like <img>, are self-closing and do not need a closing tag.
How HTM files connect to other files
An HTM file rarely stands alone. Inside the <head> section, you will typically find references to other files. A <link> tag might point to a CSS file that controls colors, fonts, and layout. A <script> tag might point to a JavaScript file that makes buttons clickable or loads content dynamically.
When a browser opens an HTM file, it reads those references and downloads the linked files. If any of those files are missing or moved to a different location, the page may look broken or behave incorrectly. This is why moving a website from one server to another requires careful attention to file paths — the HTM file needs to know exactly where to find its CSS and JavaScript companions.
Opening and editing HTM files
You can open an HTM file in any text editor: Notepad on Windows, TextEdit on Mac, or any code editor like Visual Studio Code. Simply right-click the file, choose "Open with," and select your editor. You will see the raw tags and text, which you can edit directly.
After you make changes and save the file, you can open it in a browser to see how it looks. Just double-click the HTM file or drag it into your browser window. The browser will read your changes and display the updated page. This is how web developers test their work before uploading files to a live server.
If you save a file as plain text with the .htm extension, any browser will read it as a webpage. If you save it in a word processor like Microsoft Word without converting to plain text first, the browser will see the formatting code and display it as gibberish instead of a webpage.
HTM files on your computer versus on the web
An HTM file sitting on your computer works the same way as one on a web server — your browser reads it and displays it. The difference is how you access it. A local file uses a path like file:///Users/yourname/Documents/mypage.htm. A file on the web uses a URL like https://example.com/mypage.html.
Some features work differently depending on where the file is located. JavaScript files may not load from a local HTM file due to browser security restrictions. Forms that submit data to a server will not work without an actual web server. But for viewing static content — text, images, and basic formatting — a local HTM file works perfectly fine.
Frequently Asked Questions
Can I rename an HTM file to HTML or vice versa?
Yes. Simply right-click the file, select "Rename," and change the extension from .htm to .html or the other way around. The browser will read it identically. Some web servers have preferences about which extension to use, but the file itself does not care.
What happens if I open an HTM file in a text editor instead of a browser?
You will see the raw code — all the tags and text. This is useful if you want to edit the file, but you will not see the formatted webpage. To see how it looks, save your changes and open the file in a browser instead.
Do I need special software to create an HTM file?
No. You can create one in Notepad or any text editor by typing the tags yourself, then saving the file with a .htm extension. Some people use visual editors like Adobe Dreamweaver or Webflow that generate the code for you, but they are not required.
Why do some websites use HTM and others use HTML?
Mostly habit and historical preference. HTM was necessary on older systems, so many websites still use it. HTML became the modern standard, so new websites typically use it. Browsers treat them the same, so the choice does not affect how the page works.
Can an HTM file contain images and videos?
The HTM file itself contains only text and tags. It can reference image and video files using tags like <img> and <video>, and the browser will load and display them. But the actual image or video data lives in separate files.