Uni-Sine
Computer ScienceWeb and APIs

Is HTML a programming language?

What is HTML?

MDN Web Docs describes HTML as "a descriptive language that specifies webpage structure." You wrap content in tags that say what each part is. The browser reads those labels and builds the page. Here is a small piece of HTML:

<h1>Shopping list</h1>
<p>Things to buy this week:</p>
<ul>
  <li>Milk</li>
  <li>Bread</li>
</ul>
<a href="https://example.com/recipes">See recipes</a>

This says: here is a main heading, then a paragraph, then a bulleted list with two items, then a link. It doesn't tell the computer to do anything. It describes what the content is. Tim Berners-Lee created HTML in the early 1990s as part of the World Wide Web, and today it is maintained as the HTML Living Standard by the WHATWG.

Why HTML is a markup language, not a programming language

To "mark up" text originally meant adding notes for a printer: make this bold, start a new paragraph here. A markup language does the same for a computer. A programming language instead gives the computer instructions to carry out. Programming languages can do things HTML can't:

Can it...HTMLA programming language (e.g. JavaScript)
Store values in variables?NoYes
Make decisions (if this, then that)?NoYes
Repeat steps in a loop?NoYes
Do calculations?NoYes
Respond to clicks and typing by itself?NoYes
Describe the structure of a page?YesOnly by creating or changing HTML

Here is the shopping list again, this time built by JavaScript, so you can see what programming adds. It stores the items in a variable, loops through them, and makes a decision based on how many there are:

const items = ['Milk', 'Bread', 'Eggs'];
const list = document.querySelector('ul');

for (const item of items) {
  const li = document.createElement('li');
  li.textContent = item;
  list.appendChild(li);
}

if (items.length > 2) {
  console.log('That is a big shop!');
}

HTML on its own has no way to express any of that. Add a fourth item to the array and the JavaScript adds it to the page by itself; in plain HTML you would have to type the new line in.

Try it

Code Editor

Write and run code right in your browser

Go to its page

Open the Code Editor above to try both: paste the HTML into the HTML tab, then add the JavaScript in its tab and watch the list change when you run it.

HTML, CSS and JavaScript: who does what

LanguageKind of languageIts jobIf a web page were a house
HTMLMarkup languageStructure and meaning of the contentThe walls and rooms
CSSStyle sheet languageHow it looks: colours, fonts, layoutThe paint and furniture
JavaScriptProgramming languageBehaviour: logic, interaction, dataThe electrics and plumbing

Every website uses HTML, and almost all use CSS and JavaScript as well. Our HTML, CSS and JavaScript course teaches all three in order. Try one: this question asks you to write an HTML tag.

Practice: create a H2 tag in some pre-made html with a single line text box for the user to code in

Press Mark to have your answer marked in the HTML, CSS & JavaScript course.

Is writing HTML coding?

Yes. HTML is code: it has strict rules (a syntax), and the browser reads it exactly as written. Writing it well takes real skill, especially making pages that work for people using screen readers, which depends on choosing the right elements. So writing HTML is coding, even though it isn't programming. Programming is the part of coding that writes instructions and logic.

Is CSS a programming language?

CSS is usually called a style sheet language rather than a programming language. It describes how things should look, using rules like "make every heading blue". Modern CSS can do some calculations and respond to screen size, which is why people sometimes argue about it, but it isn't used to write general programs.

Does it matter?

For learning, the label matters less than knowing what each language is for. HTML is the best first step into web development, because you see results straight away and it is the base every other web language works on. Once you are comfortable with it, JavaScript is where programming begins: variables, decisions and loops. In computer science exams, you may be asked to tell markup languages and programming languages apart, so the difference is worth knowing.

Common mistakes

  • Calling HTML a programming language on a CV or in an exam answer. Call it a markup language.
  • Thinking HTML controls how a page looks. That is CSS's job. HTML gives meaning and structure.
  • Thinking JavaScript and Java are related. They are different languages with similar names.
  • Using headings just to make text big. Heading tags describe structure; size belongs in CSS.
  • Assuming markup languages are only for the web. XML and Markdown are markup languages too.

Common questions

Is HTML a programming language?
No. It is a markup language that describes the structure of a web page. It has no variables, decisions or loops, which programming languages need.
What does HTML stand for?
HyperText Markup Language. Hypertext is text with links to other text, and markup means labels that describe what each part of the content is.
What is the difference between HTML and JavaScript?
HTML describes the content and structure of a page. JavaScript is a programming language that adds behaviour: it can store data, make decisions, respond to clicks and change the page while you use it.
Is HTML easy to learn?
It is one of the easiest coding languages to start with. You can write a working page with a few tags and see the result in a browser straight away.
Should I learn HTML or Python first?
For building websites, start with HTML, then CSS and JavaScript. For general programming, data or science, Python is a common first programming language. Many people learn both.
Is HTML still used?
Yes. Every web page is built on HTML, including pages made with frameworks such as React, which produce HTML in the end.

Revision cards

Read the front, say your answer, then flip to check.

Where to go next

  • Solve it

    Code Editor

    Write and run code right in your browser

    Open the tool
  • Learn it

    HTML, CSS & JavaScript

    Learn how to think like a web developer from the ground up

    Start the course
  • Test it

    AP Computer Science Principles

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Computer Science · Web and APIsHTML stands for HyperText Markup Language: what it meansHTML stands for HyperText Markup Language. What each word means, how tags and elements work, who invented HTML, and related acronyms like HTTP and CSS.