Should you use .htm or .html file extension? What is the difference, and which file is correct?

HtmlNaming ConventionsFile Extension

Html Problem Overview


What is the difference between the .htm and .html file extension?

Why there are two of them?

Which is correct?

Html Solutions


Solution 1 - Html

The short answer

There is none. They are exactly the same.

The long answer

Both .htm and .html are exactly the same and will work in the same way. The choice is down to personal preference, provided you’re consistent with your file naming you won’t have a problem with either.

Depending on the configuration of the web server, one of the file types will take precedence over the other. This should not be an issue since it’s unlikely that you’ll have both index.htm and index.html sitting in the same folder.

We always use the shorter .htm for our file names since file extensions are typically 3 characters long.

AND MORE ON: http://www.sightspecific.com/~mosh/WWW_FAQ/ext.html or http://www.sightspecific.com/~mosh/WWW_FAQ/ext.htm

I think I should add this part here:
There is one single slight difference between .htm and .html files. Consider a path in your server like: mydomain.com/myfolder. If you create an index.htm file inside that folder and you open that like this:mydomain.com/myfolder/, it will goes crazy and spit out your files as it is in your server,enter image description here
but if you create an index.html file in there and open that directory in your browser, it will load that file. I tested this on my VPS and found this Maybe you could somehow set your server to load index.htm files by default, but I guess the .html file is the default file type for browsers to open in each directory.

Solution 2 - Html

Neither!

If you're asking; "what would a website visitor rather type, htm or html" - it's much better to give them a nice descriptive URL with no extension. If they get used to going to yoursite/contact.html and you change it to yoursite/contact.php you've broken that link. If you use yoursite/contact/ then there's no problem when you switch technology.

Solution 3 - Html

.html always for new files. .htm is a throwback to dos days.

Solution 4 - Html

.html - DOS has been dead for a long time. But it doesn't really make much difference in the end.

Solution 5 - Html

Same thing.. makes no difference at all... htm was used in the days where only 3 letter extensions were common.

Solution 6 - Html

If you plan on putting the files on a machine supporting only 8.3 naming convention, you should limit the extension to 3 characters.

Otherwise, better choose the more descriptive .html version.

Solution 7 - Html

I guess it's a little too late now however the only time it does make a difference is when you set up HTML signatures on MS Outlook (even 2010). It's just not able to handle .html extensions, only .htm

Solution 8 - Html

It's the same in terms of functionality and support. (most OS recognize both, most Search Engines recognize both)

For my everyday use, I choose .htm because it's shorter to type by 25%.

Solution 9 - Html

Since nowadays, computers support widely any length as file type, the choice is now only personal. Back in the early days of Windows where only 3 letters where supported, you had to use .htm, but not anymore.

Solution 10 - Html

Here is some food for thought.

If you had been using all .htm files on your website and now, for example, you have changed the editor that you are using, and your new editor is outputting all your files with the .html extension. When you re-publish your site to the server, it would seem to me that you could really hurt your SEO position/ranking as many of the links out there in the web, including Google, that were looking for the .htm and not the new .html for that same page. This assumes that you are still using the same page names from your old editor which would make sense.

Anyway... My point is, be careful not to loose that link juice you have build up. So I guess in this example, there is a reason to stick with .htm... But other then that as mentioned by everyone else they seem to be the same.

Please correct if I'm wrong.

The reason I mention all this is because this is what I was in the process of doing when it occurred to me I may be damaging the site SEO with the new editor.

The original editor was MS Front Page, which always outputted .htm, dead now, and the new editor "90 Second Web Builder 9" which outputs all .html files... Luckily, they must have thought about this and they included a way to change the output extension back to .htm

Anyway, that's my 2 cents... hope it helps someone..

Solution 11 - Html

In short, they are exactly the same. If you notice the end of the URL, sometimes you'll see .htm and other times you'll see .html. It still refers to the Hyper-Text Markup Language.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCannibalSmithView Question on Stackoverflow
Solution 1 - HtmljoeView Answer on Stackoverflow
Solution 2 - HtmlFentonView Answer on Stackoverflow
Solution 3 - HtmlDanDanView Answer on Stackoverflow
Solution 4 - HtmlPavel MinaevView Answer on Stackoverflow
Solution 5 - HtmlwaqasahmedView Answer on Stackoverflow
Solution 6 - HtmlxtoflView Answer on Stackoverflow
Solution 7 - Htmluser1752458View Answer on Stackoverflow
Solution 8 - HtmlWadih M.View Answer on Stackoverflow
Solution 9 - HtmlT0xicCodeView Answer on Stackoverflow
Solution 10 - HtmlTerryDView Answer on Stackoverflow
Solution 11 - Htmluser2501407View Answer on Stackoverflow