Loading
All articles
JavaScript 17 min read

What Is HTML? A Simple Guide to the Language Behind Every Web Page

A friendly, jargon-free guide to HTML, the language every web page is written in. Learn what tags are, build a tiny page you can open in your own browser, see how browsers forgive mistakes, and peek inside the first website ever and a real Wikipedia page.

nbkhope
On this page

Every web page you have ever visited, from a news site to your bank to this article, arrives on your device as a plain text file written in HTML. You can see it for yourself: on a computer, open any website, right-click an empty spot and choose View page source (or press Ctrl+U on Windows, Option+Command+U on a Mac in Chrome). That wall of text full of angle brackets is HTML.

HTML stands for HyperText Markup Language. It sounds technical, but the idea is simple: HTML is a way of labeling text so a browser knows what each part is. "This is a heading." "This is a paragraph." "This is a link to another page." "Show a picture here." This article explains, in plain language, what HTML is, how it works, and how it became the foundation of the web.

What the name means

  • HyperText is text with links. Click a word, and you jump to another document. The idea dates back to the 1960s, but the web made it part of everyday life.
  • Markup means adding labels to text, the way an editor marks up a draft with notes like "make this a title" or "bold this word."
  • Language means there are fixed rules for how to write those labels, so every browser understands them the same way.

So HTML is not a programming language. It doesn't calculate, make decisions or repeat steps. It describes a document: what's in it and how the pieces fit together. (Programmers love to argue about this, but that's the common view.)

Tags: the labels of HTML

The labels in HTML are called tags. A tag is a word between angle brackets, like <p> for paragraph. Most tags come in pairs: an opening tag and a closing tag, which has a slash, like </p>. Whatever sits between them is the content.

The parts of an HTML tag, using the link code a href equals https colon slash slash www dot wikipedia dot org, then the words Visit Wikipedia, then the closing a tag. The opening tag is everything from the first angle bracket to the first closing bracket. Inside it, href with its value is an attribute, extra information, here where the link goes. The words Visit Wikipedia are the content. The slash a in angle brackets is the closing tag. The whole thing is called an element. In the browser, you see the words Visit Wikipedia as a blue, underlined link. Some tags have nothing inside, so they need no closing tag. The img tag, with src equals cat dot jpg and alt equals A sleeping cat, shows a picture, and the alt text describes it for people who can't see it. The br tag starts a new line
  • The opening tag says where something starts, and the closing tag says where it ends.
  • An attribute adds extra information inside the opening tag. In a link, the href attribute says where the link goes.
  • The opening tag, the content and the closing tag together are called an element.
  • A few tags, like <img> for images and <br> for a line break, have no content, so they have no closing tag.

Notice the alt attribute on the image. It's a short description of the picture. Blind people who use screen readers (programs that read the page aloud) hear it instead of seeing the picture, and it also shows up if the image fails to load.

Your first web page

Here's a complete web page. It's just a text file:

1<!DOCTYPE html>
2<html lang="en">
3  <head>
4    <meta charset="utf-8">
5    <title>My Pancake Recipe</title>
6  </head>
7  <body>
8    <h1>My Pancake Recipe</h1>
9    <p>The <strong>easiest</strong> breakfast in the world.</p>
10    <h2>Ingredients</h2>
11    <ul>
12      <li>1 cup of flour</li>
13      <li>1 cup of milk</li>
14      <li>1 egg</li>
15    </ul>
16    <p>Learn more on
17      <a href="https://en.wikipedia.org/wiki/Pancake">Wikipedia</a>.
18    </p>
19    <button>I made it!</button>
20  </body>
21</html>

We saved this file and opened it in Google Chrome. Here's exactly what appeared:

Your first web page, the HTML and what the browser shows. On the left, the file recipe.html, a plain text file with the code of the pancake recipe page. On the right, a real screenshot of that file opened in Chrome. It shows the big bold heading My Pancake Recipe, the sentence The easiest breakfast in the world with the word easiest in bold, a smaller heading Ingredients, a bulleted list with 1 cup of flour, 1 cup of milk and 1 egg, the sentence Learn more on Wikipedia with Wikipedia as a blue underlined link, and a gray button that says I made it. There is no CSS, so the browser uses its default look

Let's read it from the top:

  • <!DOCTYPE html> tells the browser "this is a modern HTML page."
  • <html> wraps the whole page. lang="en" says it's in English, which helps screen readers pronounce words correctly.
  • <head> holds information about the page that isn't shown in it, like the <title>, which appears on the browser tab and in search results.
  • <body> holds everything you actually see.
  • <h1> is the main heading and <h2> a smaller one. There are six levels, down to <h6>.
  • <p> is a paragraph, <strong> marks important words (shown in bold), <ul> is a bulleted list and each <li> is one item in it.
  • <a> is a link (the "a" stands for "anchor") and <button> is a button. This button doesn't do anything yet: making it react to a click is JavaScript's job.

The page looks plain because it has no CSS, the language that controls colors, fonts and layout. Without it, every browser uses the same simple default look: big bold headings, bullets and a gray button.

Try it yourself

You don't need to install anything:

  1. Open a plain text editor: Notepad on Windows, or TextEdit on a Mac (choose Format, then Make Plain Text).
  2. Copy the code above into it.
  3. Save it as recipe.html.
  4. Double-click the file. It opens in your web browser, and you've made a web page.

Change the words, save, and refresh the browser to see your changes.

The page is a tree

When the browser reads HTML, it doesn't keep it as text. It builds a tree out of it, like a family tree: each tag becomes a box, and the tags inside it become its children.

The browser turns the HTML into a family tree. At the top is html. Its two children are head and body. Under head are meta and title. Under body are h1, p, h2, ul, p and button. Under the first p is strong. Under ul are three li items. Under the second p is a. Each tag becomes a box, and tags inside it become its children. This tree is called the DOM, the Document Object Model. CSS styles its boxes, and JavaScript can change them while you look at the page

Programmers call this tree the DOM (Document Object Model). It's what the other two web languages work with. CSS says how each box should look. JavaScript can add, remove or change boxes at any time, which is how a page shows a new message without reloading.

A common way to picture the three languages: HTML is the frame of a house, CSS is the paint and decoration, and JavaScript is the electricity that makes things work when you flip a switch.

How a browser shows a page

How a browser shows a web page, in five steps. One, you ask: you type an address or click a link. Two, the HTML arrives: the website's server sends back an HTML file. Three, the browser reads it: it builds the tree of boxes from the tags. Four, extras arrive: it downloads what the HTML points to, CSS, images and JavaScript. Five, the page appears: it paints everything on your screen. The HTML always comes first, because it is the list of everything the page contains and needs

The HTML file is always the first thing to arrive. Pictures, videos, styles and scripts are separate files, and the HTML points to each of them with tags like <img>, <link> and <script>. That's why, on a slow connection, you sometimes see the text of a page before its pictures or its design.

Tags that say what each part is

Some tags don't change how anything looks. Instead, they say what each part of the page is:

Tags that say what each part of a page is, shown as a web page divided into boxes. At the top, header, the top of the site, with the logo and name. Below it, nav, the menu of links. In the middle, main, the main content of this page, and inside it an article, a story or post that makes sense on its own, with an h1 heading that says How to make pancakes. On the right side, aside, related extras. At the bottom, footer, with contact information and copyright. These tags don't change the look by themselves. They tell screen readers, search engines and other programs what each part is, so a blind visitor can jump straight to the main content

This is called semantic HTML ("semantic" means "about meaning"), and it matters more than it seems:

  • Accessibility. Screen readers use these tags to let blind and low-vision visitors jump straight to the menu or the main content, instead of listening to the whole page from the top.
  • Search engines. Google and others read the HTML to understand what a page is about. Headings and articles help them.
  • Reader mode and other tools. Your browser's "reader view," translation tools and AI assistants all rely on the HTML to find the real content.

You could build a whole page out of <div> tags, which are just plain boxes, and it could look exactly the same. But to a screen reader or a search engine, it would be a page with no signposts.

HTML forgives mistakes

Most computer languages stop with an error message if you make a single typo. HTML doesn't. Browsers are built to do their best with whatever they get. We tried it with a messy file where we forgot to close the heading tag:

HTML forgives mistakes. On the left, a file called oops.html whose tags were never closed. It has a title, an h1 heading that says My page with no closing tag, a paragraph that says I forgot to close the heading, a paragraph that says Now everything is huge, and a list with One and Two. On the right, a real screenshot from Chrome. Every line appears in giant bold heading text. There was no error message. The browser guessed that the heading never ended, so it put everything inside it and the whole page became a giant heading

Chrome showed no error. It guessed that the heading never ended, so it put everything inside it, and the whole page became a giant heading. It also quietly closed the paragraphs and list items for us.

This forgiving behavior was a deliberate choice, and it's one reason the web grew so fast: anyone could write a page, and small mistakes didn't stop it from working. Since HTML5, the rules spell out exactly how browsers should repair broken pages, so Chrome, Safari, Firefox and Edge all fix them the same way.

The most common tags

You can do a lot with a handful of tags:

TagWhat it isExample
<h1> to <h6>Headings, from biggest to smallest<h1>My Blog</h1>
<p>Paragraph<p>Hello there.</p>
<a>Link<a href="https://example.com">Click</a>
<img>Image<img src="dog.jpg" alt="My dog">
<ul>, <ol>, <li>Bulleted list, numbered list, list item<li>Milk</li>
<strong>, <em>Important (bold) and emphasized (italic) text<em>really</em>
<div>, <span>Plain boxes for grouping things, to style them with CSS<div>...</div>
<table>, <tr>, <td>Table, row and cell<td>42</td>
<form>, <input>, <button>Forms, text boxes and buttons<input type="email">
<video>, <audio>Video and sound players<video src="cat.mp4" controls>

Inside a real web page

How do real pages use these tags? We downloaded the HTML file of Wikipedia's article about HTML and counted every tag in it:

Inside a real web page today. We downloaded the HTML file of Wikipedia's article about HTML and counted its tags. The 10 most common: a, link, 2,190; span, a piece of text to style, 1,959; li, list item, 1,556; div, a box that groups things, 366; code, computer code, 250; link, which connects another file such as a style sheet, 210; ul, bulleted list, 178; td, table cell, 161; sup, raised text such as footnote numbers, 122; tr, table row, 121. Then and now: the first website, from 1992, is 2.2 kilobytes with 50 tags. Wikipedia's HTML article is 799 kilobytes with 7,864 tags. This is only the HTML file. The page also downloads CSS, JavaScript and images, which are counted separately
  • The page has 7,864 tags of 58 different kinds.
  • The most common tag is the link, <a>, with 2,190. That's the "hyper" in hypertext: Wikipedia is a giant web of links.
  • Next come <span> and <li>, used for the menus, the footnotes and the long lists of references.
  • The HTML file alone is about 799 KB, roughly 360 times bigger than the first website ever made.

The first website still works

HTML was invented by Tim Berners-Lee, a British scientist at CERN, the physics laboratory near Geneva, Switzerland. In 1989 he proposed a system to help scientists share documents, and by 1991 he had built the first web browser, the first web server and the first website. HTML was based on an older markup language called SGML, which CERN already used for its documents.

CERN still keeps a copy of that first website online. We opened it in Chrome:

The first website still works. A screenshot of info.cern.ch slash hypertext slash WWW slash TheProject.html opened in Chrome. It shows the heading World Wide Web, a paragraph explaining that the WorldWideWeb, W3, is a wide-area hypermedia information retrieval initiative aiming to give universal access to a large universe of documents, and a list of links such as What's out there, Help, Software Products, Technical, Bibliography, People, History, How can I help and Getting code. The file is 2,217 bytes in total, with 50 tags of 10 kinds, including 25 links. The oldest saved copy of the first website, from 1992, opened in Chrome in 2026. It has no pictures, colors or styles, only text and links, and it still works

It's only 2,217 bytes, less than a short email. It has no pictures, colors or styles, just headings, text and 25 links. Some of its tags, like <NEXTID>, are no longer part of HTML, yet a 2026 browser opens it without trouble. That's one of HTML's quiet superpowers: pages written more than 30 years ago still work.

HTML keeps growing

The first description of HTML, a 1991 document called "HTML Tags," listed fewer than two dozen tags. We counted the tags in each version's official list since then:

HTML keeps growing. Number of tags, or elements, in each version's official list. HTML 2.0, 1995: 49 tags, with headings, links, lists, images and forms. HTML 3.2, 1997: 70, adding tables, scripts, styles and div. HTML 4.01, 1999: 91, adding span, button, label and iframe. The HTML Living Standard, 2026: 113, adding video, audio, canvas, nav, main and dialog. Counted from the official lists of HTML 2.0, 3.2 and 4.01 and the HTML Living Standard. The counts include old tags that were later retired, such as font and center

In the late 1990s, during the "browser wars" between Netscape and Microsoft's Internet Explorer, each company invented its own tags to win users. Netscape had <blink>, which made text flash on and off, and Internet Explorer had <marquee>, which made text scroll across the screen. Pages often worked in one browser and broke in the other.

Standards bodies stepped in. The World Wide Web Consortium (W3C), founded by Berners-Lee in 1994, published official versions of HTML. In 2004, Apple, Mozilla and Opera, frustrated with the W3C's direction, formed their own group, the WHATWG, and started what became HTML5. It added video and audio without plug-ins like Flash, drawing with <canvas>, and tags like <nav> and <article>. HTML5 became an official W3C standard in 2014.

Today, HTML is a "living standard": since 2019 there is just one version, maintained by the WHATWG with browser makers, and it gets small updates all the time instead of big numbered releases. That's why nobody talks about "HTML6."

A short history of HTML, as a timeline. 1989: Tim Berners-Lee proposes the web at CERN. 1991: the first website, and the "HTML Tags" document is published. 1993: the Mosaic browser shows pictures inside pages. 1995: HTML 2.0, the first official standard. 1997: HTML 3.2 and 4.0, with tables, styles and scripts. 1999: HTML 4.01. 2004: browser makers form the WHATWG. 2008: the first draft of HTML5. 2014: HTML5 becomes official. 2019: one "living standard" for everyone

Common questions

Is HTML hard to learn? No. It's often the first thing people learn in web development. You can learn the basic tags in an afternoon and make a real page the same day.

Do I need HTML if I use a website builder? Not to get started. Tools like WordPress, Wix or Google Sites write the HTML for you. But knowing a little HTML helps you fix things when they look wrong.

Is HTML still used, or has something replaced it? Every web page still reaches your browser as HTML. Many modern sites are built with tools and frameworks that generate it automatically, but HTML is always what comes out the other end. Many phone apps and even some desktop apps, like VS Code, are built with HTML inside too.

What's the difference between HTML and a website? A website is usually many HTML pages, plus CSS, JavaScript, images and a server that sends them. HTML is the part that holds the content and structure.

Glossary

  • HTML: HyperText Markup Language, the language web pages are written in.
  • Tag: a label in angle brackets, like <p>, that marks where a part of the page starts or ends.
  • Element: an opening tag, its content and its closing tag, together.
  • Attribute: extra information inside an opening tag, like href in a link or alt in an image.
  • Browser: the app you use to visit websites, like Chrome, Safari, Firefox or Edge.
  • DOM: the tree of boxes the browser builds from the HTML.
  • CSS: the language that controls how a page looks.
  • JavaScript: the language that makes a page interactive.
  • Semantic HTML: using tags that describe what each part of a page is, like <nav> or <article>.
  • Screen reader: a program that reads a page aloud for people who are blind or have low vision.
  • WHATWG: the group of browser makers that maintains the HTML standard today.

Wrapping up

HTML is the oldest and simplest of the web's three languages, and the one everything else is built on. It's a set of labels that tell a browser what each piece of text is: a heading, a paragraph, a link, an image. Browsers turn those labels into a tree, fill it with styles and scripts, and paint it on your screen, forgiving your mistakes along the way.

The first website was 2,217 bytes of HTML, and it still opens today. If you want to try it yourself, write the pancake page in Notepad, double-click it, and you'll have built your own small piece of the web.

Thanks for reading!

Know someone who would enjoy this? Send it their way.

More articles

Read next

Comments

Be kind and specific. Comments with links from new accounts appear after a moderator reviews them.