.html

What is a .html file?

HyperText Markup Language · Code and data · Tim Berners-Lee / W3C · 1993

HTML is the language of web pages. It uses tags to describe headings, paragraphs, links and images, and every browser turns it into the pages you read. An HTML file is plain text that you can open and edit anywhere.

Category
Code and data
MIME type
Type
Plain text
Also seen as
.htm
Is a .html file safe to open? An HTML file can contain scripts. Opening a saved page from an unknown source in a browser can run that script, so treat unexpected .html attachments with care.

What is a .html file used for?

HTML marks up content with tags so a browser knows what is a heading, a paragraph, a link or an image. It is the structural layer of every website.

On its own it handles structure, with CSS adding style and JavaScript adding behaviour. A saved .html file opens straight into any browser.

Because it is plain text, you can view and edit HTML in any code editor, which is how the web stays open and inspectable.

How to open a .html file

The .html format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .html file.

Windows

  • Any browser
  • VS Code
  • Notepad++

macOS

  • Any browser
  • VS Code

Linux

  • Any browser
  • VS Code

Web

  • Every browser renders HTML

How to convert a .html file

You can convert a .html file to PDF, TXT, MD using a conversion tool or the export menu of an app that opens it.

.html file signature (magic bytes)

Programs recognise a .html file by the bytes at the start of the file, not by its name. These are the signatures for HTML.

Hex signatureOffsetNote
3C 21 44 4F 43 54 59 50 450'<!DOCTYPE'
3C 68 74 6D 6C0'<html'

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .html file?

HTML is the language of web pages. It uses tags to describe headings, paragraphs, links and images, and every browser turns it into the pages you read. An HTML file is plain text that you can open and edit anywhere.

How do I open an HTML file?

Double-click it to view in your browser, or open it in a code editor like VS Code to see and change the source.

Related formats

Sources

Details on this page were checked against authoritative references: