Is HTML a programming language?

Is HTML a programming language?
Sep 9, 2021 · 3 min read

What is a programming language? This is a question that seems hard to grasp for a lot of people. In the context of the popular language HTML this confusion often comes to light. Is HTML classified as a programming language? If not then why and how is it different?

The definition of a programming language

On a high level a programming language is a composition of words following a clearly defined set of rules. These word compositions are analyzed and compiled (by a so-called compiler) to code that is executed by your computer. This code is often called machine code and is instructions for your computer.

Programming languages are created for humans to be able to create instructions for a computer in a format that we’re used to. The formality of the languages makes instructing a computer a lot easier to learn, manage and achieve in cooperation with other humans.

The definition of a markup language

A markup language lets you, with a set of tags, define the structure, format and hierarchy of a digital document. A tag marks the type of a structural component in a document. It’s basically a way to categorize the parts that are being composed. When creating a document you expect to be able to create a variety of different components.

A markup language differs from a programming language by the fact that it doesn’t directly create instructions for a computer to execute. What you write is processed by other applications that are created with programming languages. It’s in a way instructions for programmed applications.

Hypertext Markup Language (HTML)

HTML is a markup language that’s used to define the structure of a web page, basically a blueprint read by the browser. You could see your web page as a house and HTML as the frame, a building foundation that decides the structural components with hierarchy and type.

In HTML the structural components are called elements. To describe these elements the language includes a certain set of attributes, some that are unique for one or several elements. These attributes can for example be used to give an element a name, an ID or a description meant for blind users (transformed to speech by the users browser).

Is HTML a programming language then?

No, HTML is not a programming language. As described in this article there’s a significant difference between a programming language and a markup language.

A markup language is written to be processed by an application that understands its rules. The application on the other hand is written in a programming language with rules known to a compiler. In the end the compiler transforms the program into machine code that is understood and executed by your computer and its CPU (central processing unit).

Since HTML is a markup language for the browser it is read and processed by a so-called browser engine. This type of engine is the core of a browser and its job is to transform one or more languages, in several steps, into a representation shown on your screen.