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?
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?
However, before I get to the answer, here are some quick points:
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.
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.
A typical microwave consumes more electricity in running its clock than heating food. [more...]