HTML file extension

I have a question regarding the HTML Elements and Structure which states that " […] HTML code is always saved in a file with an .html extension." Is a .htm extension no longer valid? Also I was given to understand that the file extension is only to help Windows to identify it, and that other software doesn’t care?

1 Like

When you save the file locally, the difference doesn’t matter - your local system will likely treat the two file extensions as interchangeable for loading by your browser. The reason for it is that historically Windows-based systems used 3 letter extensions ( htm ) and Unix-based systems the 4 letters ( html ).

On a server-side, there may be some differences when it comes to serving default filenames

Hope this helps :grinning:

3 Likes

Ah okay, thats interesting

1 Like

if you have a server available, create a test folder, on the site root. Call it test.

Create two HTML documents with TITLE elements, HTM and HTML, then upload each. Use the .htm extension on one, .html on the other.

Navigate to www.yoursite.com/test/. What appears in the titlebar? HTM or HTML. That will tell you which extension is the server default when index.html (or index.htm) is not included in the request URL.

1 Like