skip to content

Is HTML A Programming Language? (video player)

Transcript ↓

In this episode of Webbed Briefs, I shall be asking the question, “Is HTML A Programming Language?” And—spoiler alert—I shall be answering that question, quite emphatically, with this word: “Yes”, which is the standard British English term for “Yes”.

That’s the easy part out of the way. Now let’s examine some of the objections to the unequivocally true statement, “HTML is a programming language”.

(1) “You can't write a program with HTML”

What is programming? Programming is giving computers instructions. It’s telling them what to do. Programming languages are grammars understood by and intended for computers.

With that in mind, your first clue that HTML is a programming language is that you don't see HTML tags on a rendered web page. That's because they are not intended to be seen and read directly by human visitors to that page.

Your second clue that HTML has gone and done some ruddy programming all up in your computer is the graphical topography of the web page you are looking at. Without HTML instructing the computer to structure and format it according to the HTML author’s instructions, it would look something like this.

(2) “HTML is not Turing complete”

Neither are the languages SQL, Sequel, or Skwool.

Turing completeness is one way of measuring the capacity of general purpose programming languages, not a test for programming per se.

HTML is a domain specific programming language, not designed for anything but rendering web documents: a singular but important purpose. I feel like this is a fairly simple diagram to understand. So this shouldn’t give you much trouble either. Or this.

(3) “HTML isn’t a programming language, it’s a markup language”

Sure, and this isn’t a quadruped, it’s a horse. A markup language is not a natural language; it has strict syntactical rules intended to be understood by computers. And the only reason we want computers to understand those rules is in order to tell the computer what to do AKA programming.

What you really mean when you say “HTML isn’t programming” is “HTML isn’t the kind of complex or impressive programming I—a person desperate to make claims of intelligence—could possibly lower myself to be associated with.” Which is all the more embarrassing for you when the HTML you do end up writing sucks so much ass.

(4) “You can tell HTML isn’t programming because it doesn’t have if statements”

First of all, yes it f**king does. But also: do you see any if statements on this, a punch card? Even one? No you can’t. And if punch cards “aren’t programming” then we’re missing a rather important antecedent to the programming that does fit your wild preconceptions.

Also, what the f**k is this expression? No if statements here, can’t be programming then.

Instead of getting hung up on specific language features and formats, a much simpler way of determine whether some text is programming or not is to try and use it to tell a human being to do something.

If you don’t believe HTML is a programming language because it is declarative and you simultaneously believe procedural JavaScript is improved by adopting a more declarative style, you may have brain worms.

(7) “HTML doesn't do anything on its own, it needs a browser to work”

We’ve only just met, and this is crazy, but all programming needs something to program and an environment in which to perform that activity. Unless your intention is to, let’s say, sell the text representing an unexecuted program as an NFT, your program has no value in and of itself. NFTs don’t actually have anything but a purely transactional value anyway, but that’s beside the point.

(It is one.)

(8) “If HTML is a programming language, then a Word document is a programming language”

A Word document is not a language at all, you absolute f**khead. You are reaching so hard to support your parochial views on programming, you’ve conflated markup with the graphical user interface of a proprietary desktop publishing application.

In summary:

  1. HTML is a declarative language
  2. HTML is a domain specific language
  3. HTML is a markup language
  4. HTML is a Turing incomplete language
  5. HTML is not a natural language
  6. HTML is a programming language
  7. And so is CSS