Ffile2fix
Sign in Get started

What is a .html file?

An .html file is a web page written in HyperText Markup Language, the tag-based format browsers render. You meet it as saved web pages, email templates, exported reports, static sites and the index.html of every web project.

Key facts

  • Plain text following the WHATWG HTML Living Standard; modern files start with <!DOCTYPE html>.
  • MIME type is text/html; .htm is an older equivalent extension.
  • Links to CSS, JavaScript and images by URL or relative path, so a single .html file often looks broken when moved without its folders.
  • Browsers are forgiving and repair invalid markup silently, which can hide errors until layouts break.
  • Created by hand, by CMSs and site generators, by email builders and by 'Save page as' in browsers.

How to open a .html file

Windows

Double-click to open it in Edge, Chrome or Firefox; right-click and choose Open with > VS Code or Notepad to edit the source.

macOS

Double-click to open it in Safari or another browser; open it in VS Code to edit, as TextEdit may display it rendered unless 'Display HTML files as HTML code' is enabled.

Linux

Run xdg-open page.html to view it in your default browser, or edit it with any text editor such as nano or VS Code.

Common problems and fixes

Accented characters show as é or ?
The file's encoding and its declared charset disagree. Save the file as UTF-8 and add <meta charset="utf-8"> as the first element inside <head>.
Page opens without styling or images
The CSS, image or script paths are relative and the folders were not copied, or they point to an absolute local path. Keep the page and its assets folder together and check paths in the browser's DevTools Network tab.
Browser shows the raw HTML code instead of a page
The file was saved as .txt, or the server sends it with Content-Type text/plain. Rename it to .html and make sure the server sends text/html.
Layout breaks or content disappears
An unclosed tag, wrong nesting or stray quote is confusing the parser. Run the markup through a validator and fix the first reported error first, as later ones often follow from it.

Often converted to or from: PDF, Markdown, plain text, DOCX, image (PNG)

Frequently asked questions

Is it safe to open an .html file from an email?

HTML attachments are a common phishing method because they can show fake login pages or run scripts. Do not open unexpected HTML attachments, and never enter passwords into a page opened from a local file.

What is the difference between .html and .htm?

None in practice; .htm dates from systems that only allowed three-letter extensions. Browsers and servers treat both the same.

How do I convert an HTML file to PDF?

Open it in a browser and choose Print > Save as PDF. For automation, tools such as headless Chrome or wkhtmltopdf convert from the command line.

See all file types β†’ Β· Browse error fixes β†’