WDN Logo

home-icon Home / Answers / What is the difference between .htm and .html files?

What is the difference between .htm and .html files?

Difference between .html and .htm files

What’s the difference between .htm and .html? I’ve come across both these on the web. And can you advise on which one I should use?
Suraini Sami

Both .htm and .html are file extensions for HTML (HyperText Markup Language) files. So, to frame the question correctly for the benefit of all, what is the difference between these two file extensions?

Sponsored Links

However, before I get to the answer, here are some quick points:

  • Both .htm and .html are plain text (ASCII) files
  • They are typically used for web pages

.htm and .html are the same

There is absolutely no difference between .html and .htm files. They can be used interchangeably. Thus, you can rename a .html file to .htm and vice versa and the browser program will display it the same way.

The only difference is the file extension.

So why have two file extensions for the same kind of file? That, my friend, is because once upon a time, on many operating systems, file extensions could only be of three characters. This was especially true for Microsoft Windows, the most popular OS.

Thus, a lot of web pages created in “the good old days” (just a decade back or so) will have .htm file extension. And, I suppose, many old-schoolers would still be using .htm instead of .html.

Which is better and which one should you use?

Personally, I stopped using the three letter file extensions long time back and suggest you do the same. .htm seems a bit ancient in my opinion.

Finally, here is another bit of information. Files with .html or .htm extension may contain server-side code too. Thus, one can put PHP code and have it run with these files extensions. This is done by changing the server settings so that the files are parsed through the PHP interpreter. The web browser, however, will never show server-side code and present only HTML to the viewer.

Sponsored Links

Search

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

IMDb.com was created by Col Needham in 1990 and sold to Amazon.com in 1998. [more...]

Share on Whats app Share on Facebook Share on Twitter Share on Google plus