If you are looking for the answer to what extension HTML documents should have, the short version is this: it is usually .html, and sometimes .htm. Both are standard for web pages, and modern browsers open them in the same way.
Which extension is considered standard
The most common extension for HTML documents is .html. It is the one you will usually see on new websites, in tutorials, and in most documentation. It makes it immediately clear that the file contains HTML code and is meant to be displayed in a browser.
The .htm extension is also correct. It dates back to a time when some operating systems and servers only supported short file names. That limitation is mostly irrelevant today, but older websites may still use it.
What is the difference between .html and .htm
For users and browsers, there is almost no difference. Both formats work as normal HTML pages. The choice usually depends on project conventions or on how files are named on a particular site.
- .html is the more modern and widely used option.
- .htm is a compatible alternative that is still supported.
- The file content matters more than the extension: if the HTML structure is valid, the page will display correctly.
How to name an HTML file correctly
If you are creating a page manually, the best choice is a clear name with the .html extension. For example: index.html, about.html, or contacts.html. These names are easy to maintain, useful for site structure, and less confusing when working with files.
In most cases, the main page of a website is called index.html. Servers are often configured to open this file automatically when a user visits a folder or a domain without specifying a page name.
What else matters in HTML documents
The file extension is only part of the picture. The document itself must also include the correct HTML structure: the doctype declaration, the html tag, a head section, and the content inside body. This is what allows the browser to interpret the page properly.
It is also important not to confuse file extensions with other web formats. For example, .css is used for styles, .js for JavaScript, and .php for server-side processing. HTML is responsible for the basic structure of a web page.
Conclusion
So, in answer to what extension HTML documents should have, the correct choice is .html, although .htm is still a valid option. If you are building a new site or a learning project, .html is the clearest and most modern standard.
