htmlnaming-conventionsfile-extension

Should I use the .htm or .html file extension? Which one is correct?


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

Why there are two of them?

Which is correct?


Solution

  • The short answer

    There is none. They are exactly the same. Source

    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.