HTML is not a programming language.
I’ve heard that sentence so many times and it’s tiring. Normally, it is followed by something like,
It doesn’t have logic, or,
It is not Turing complete,.so… obviously it is not a programming language. Like it’s case-closed and should be the end of the conversation.
Should it be, though?
I want to look at typical arguments I hear used to belittle HTML and offer my own rebuttals to show how those claims are not completely correct.
My goal is not to prove that HTML is or is not a programming language, but to show that the three main arguments used for claiming it is not are flawed or incorrect, thus invalidating the conclusion from a logical point of view.
“HTML is a markup language, not a programming language”
This statement, by itself, sounds great… but it is wrong: markup languages can be programming languages. Not all of them are (most are not) but they can be. If we drew a Venn diagram of programming languages and markup languages, it would not be two separate circles, but two circles that slightly intersect:
A markup language that operates with variables, has control structures, loops, etc., would also be a programming language. They are not mutually exclusive concepts.
TeX and LaTeX are examples of markup languages that are also considered programming languages. It may not be practical to develop with them, but it is possible. And we can find examples online, like a BASIC interpreter or a Mars Rover controller (which won the Judges’ prize in the ICFP 2008 programming contest).
While some markup languages might be considered programming languages, I’m not saying that HTML is one of them. The point is that the original statement is wrong: markup languages can be programming languages. Therefore, saying that HTML is not a programming language because it is a markup language is based on a false statement, and whatever conclusion you arrive at from that premise will be categorically wrong.
“HTML doesn’t have logic”
This claim demands that we clarify what “logic” means because the definition might just surprise you.
As with Turing-completeness (which we’ll definitely get to), those who bring this argument to the table seem to misunderstand what it is exactly. I’ve asked people to tell me what they mean by “logic” and have gotten interesting answers back like:
Logic is a sensible reason or way of thinking.
That’s nice if what we’re looking for is a dictionary definition of logic. But we are talking about programming logic, not just logic as a general term. I’ve also received answers like:
Programming languages have variables, conditions, loops, etc. HTML is not a programming language because you can’t use variables or conditions. It has no logic.
This is fine (and definitely better than getting into
OR/etc.), but also incorrect. HTML does have variables — in the form of attributes — and there are control structures that can be used along with those variables/attributes to determine what is displayed.
<noscript> – which are rudimentary control structures and have been part of the standard for decades. I’m referring to elements that will respond to the user input and perform conditional actions depending on the current state of the element and the value of a variable. Take the
<summary> tuple or the
<dialog> element as examples: when a user clicks on them, they will close if the
So just saying alone that HTML isn’t a programming language because it lacks logic is misleading. We know that HTML is indeed capable of making decisions based on user input. HTML has logic, but it is inherently different from the logic of other languages that are designed to manipulate data. We’re going to need a stronger argument than that to prove that HTML isn’t a form of programming.
“HTML is not ‘Turing complete’”
OK, this is the one we see most often in this debate. It’s technically correct (the best kind of correct) to say HTML is not Turing complete, but it should spark a bigger debate than just using it as a case-closing statement.
I’m not going to get into the weeds on what it means to be Turing complete because there are plenty of resources on the topic. In fact, Lara Schenck summarizes it nicely in a post where she argues that CSS is Turing complete:
In the simplest terms, for a language or machine to be Turing complete, it means that it is capable of doing what a Turing machine could do: perform any calculation, a.k.a. universal computation. After all, programming was invented to do math although we do a lot more with it now, of course!
Because most modern programming languages are Turing complete, people use that as the definition of a programming language. But Turing-completeness is not that. It is a criterion to identify if a system (or its ruleset) can simulate a Turing machine. It can be used to classify programming languages; it doesn’t define them. It doesn’t even apply exclusively to programming languages. Take, for example, the game Minecraft (which meets that criterion) or the card game Magic: The Gathering (which also meets the criterion). Both are Turing complete but I doubt anyone would classify them as programming languages.
The definition of what programming is (or is not) changes with time. I bet someone sorting through punched cards complained about how typing code in assembly was not real programming. There’s nothing universal or written in stone. There’s no actual definition.
Turing-completeness is a fair standard, I must say, but one that is biased and subjective — not in its form but in the way it is picked. Why is it that a language capable of generating a Turing Complete Machine gets riveted as a “programming language” while another capable of generating a Finite State Machine is not? It is subjective. It is an excuse like any other to differentiate between “real developers” (the ones making the claim) and those inferior to them.
To add insult to injury, it is obvious that many of the people parroting the “HTML is not Turing complete” mantra don’t even know or understand what Turing-completeness means. It is not an award or a seal of quality. It is not a badge of honor. It is just a way to categorize programming languages — to group them, not define them. A programming language could be Turing complete or not in the same way that it could be interpreted or compiled, imperative or declarative, procedural or object-oriented.
So, is HTML a programming language?
If we can debase the main arguments claiming that HTML is not a programming language, does that actually mean that HTML is a programming language? No, it doesn’t. And so, the debate will live on until the HTML standard evolves or the “current definition” of programming language changes.
But as developers, we must be wary of this question as, in many cases, it is not used to spark a serious debate but to stir controversy while hiding ulterior motives: from getting easy Internet reactions, to dangerously diminishing the contribution of a group of people to the development ecosystem.
Or, as Ashley Kolodziej beautifully sums it up in her ode to HTML:
Independent of the stance that we take on the “HTML is/isn’t a programming language” discussion, let’s celebrate it and not deny its importance: HTML is the backbone of the Internet. It’s a beautiful language with vast documentation and extensive syntax, yet so simple that it can be learned in an afternoon, and so complex that it takes years to master. Programming language or not, what really matters is that we have HTML in the first place.
I have a few opinions on this that I was intending to make into a blog post, but this comment thread will probably close by the time I get around to that, so here goes:
When I say HTML is not a programming language, I do so with the intent to praise the foresight and restraint of the people who shaped it, and the skill and ingenuity of people who make amazing things with it.
is not. The latter implies that it is instead a fake programming language.
I feel like discussions on this topic are dominated by these two points of view: “programming language” as a rigorously defined scientific term, and “programming language” as an arbitrarily assigned social status. In reality, it’s a fuzzy classification like most words in human languages.
Trying to find strict criteria for what counts as a programming language can be a fun exercise if we stop getting attached to the social status of our tools. I’ll start:
A programming language has (formally or informally) defined runtime semantics.
Pretty pedantic really.
I think the real question to ask here is why does it matter? I don’t doubt that many people who utter tha phrase, ‘Html is not a programming language’, mean it with mal-content. However, what I do believe is that it is so utterly unimportant whether or not it is a programming language altogether. At the end of the day, ‘programming language’ is just some arbitrary label we give to things. Humans made it up and Humans assign value to it.
This theme follows the age old backend vs frontend comments which, let’s be honest, usually only resonates with those of us more early on in our careers. Frankly, different areas require different skills, and furthermore, different skills have different levels of context required, details to learn.
Human languages are imprecise, so you’re always going to be able to chip away at the edges of the term “programming language”.
What people are really reaching for when they say HTML is not a programming language is that you can’t do the things with it that you can with other technologies that undeniably programming languages.
I’m not sold on the argument that HTML isn’t a programming language for lack of logic. I can acknowledge that HTML has variables, but I see no evidence that there’s any logic. Yes, stuff happens when the open attribute is present/removed, but is that a result of logic, or is it thanks to default styling, or in other words CSS? Because if interactivity is thanks to CSS, then it’s a crutch on which HTML can’t do anything without and no logic can be attributed to HTML alone.
The interactivity with
summaryis without CSS. Checking the developer tools, no additional native styles are applied by the browser when
No it’s not a programming language but just a f***** mark up language. End of any further discussion.
That’s what backend devs always say.
It’s a form of text encoding though? Sure maybe some people out there are belittling web developers and that’s just silly. However, it doesn’t change the fact that HTML is just the same as JSON or XML. It’s just encoded text meant to be parsed by a program
This is what argument #1 of the article rebutts: being a mark-up language and a programming language is not mutually exclusive. There are examples of computer languages that are both. For example, Tex is a programming language and a mark-up language, and it has been around for over 40 years.
I’m a long-time developer and for fun, I teach a high school class that I call “Intro to Coding,” which I just hope nobody thinks it’s about medical coding or something else. I’ve thought long and hard about the question, and the reason why I call it “coding” and not “Into to Programming.”
HTML is code
HTML is not programming
If HTML grows to become some kind of programming and not just coding, it’s probably advanced too far.
I’m not sure why this is even an issue. In the same way a card game can be Turing-complete with no intention of being a programming language, HTML was never intended to be a programming language, and even if it were Turing-complete, it wouldn’t change that fact.
Here, I’m using the term “programming language” in the sense that it has been used for decades now, which is that if you want to write a computer program, you must decide on a language to write that program in. I doubt there’s any sane person who would think that writing a computer program would mean the same thing as designing a web page. Clearly that’s not what is meant by that!
When one decides on a language to write a program in, it’s really just a matter of preference or convenience usually, since all programming languages are equivalent in that sense.
Turing-completeness does matter here and is not “fashionable” by any stretch. It had been long established that any (general-purpose) programming language must be Turing-complete when I was in college some 25+ years ago.
Now there have always been special-purpose programming languages, which is not what one means when referring to the unqualified term “programming language”. Those are for specific devices that have their own special means of programming them. The language wouldn’t have much use outside of those particular devices.
In any case, I still don’t understand why anyone would want to add such confusion to terminology that has been used this way for a very long time. It definitely serves a purpose because you don’t want people learning a language like HTML specifically to write computer programs only to realize that it is not what that language is designed for, simply because somebody decided the term “programming language” needed to be more ‘inclusive’.
this article is even more pedantic than the claims about html it tries to refute. there’s nothing wrong or harmful whatsoever with the statement that html is a markup language and not a programming language.
To my mind, HTML is just a data format, no different than JSON or CSV.
HTML can be “coded” insofar as it can be manually constructed in a text editor — as can CSV, JSON, etc. — but the end result is what it is.
If a given document is opened in a given browser twice, the behaviors won’t be (and can’t be) any different the second time around.
But that said, I like to think of “programming” as the act of “reaching consensus with a machine”. Given how complicated the HTML spec is, getting a page to “look right” can certainly feel like programming sometimes. ;)
I usually answer the question along these lines: HTML is a data encapsulation and presentation format, derived as a subset of SGML, something a lot of people don’t know or have forgotten. That it may not encapsulate data as “elegantly” or succinctly as JSON or [CT]SV is due to its presentational aspect (as well as beside the point). Just like TeX, Postscript, etc..
Definitely Minecraft is more a programming language than html.
One program definition as a noun: a set of related measures or activities with a particular long-term aim.
One as a verb: provide (a computer or other machine) with coded instructions for the automatic performanc
My bread and butter is C++, but based on these definitions, I think it is completely fair to call HTML a programming language. And is fair to call C++ a markup language, as what is being created is markup that can be processed by a C++ compiler just as much as HTML is markup to be processed by a web browser.
You may not be aware, but the definition you drew upon for the word ‘program’ has little to do with a computer program, unless that’s in reference to something like a school’s curriculum in the category of ‘computer’. That’s an example of where the term “computer program” would have a completely different meaning from what is implied within the present context. Be careful using dictionary definitions of words in this way. Many times the correct meaning of a term cannot be inferred by simply breaking down its constituents!
If so, I would like to see HTML text compiled into machine language….
Turing completeness is not as arbitrary as you make it out to be. It’s arbitrary in the sense that we could also test for equivalent lambda calculus or register machines, but what makes Turing machines useful is that if a problem isn’t solvable by a Turing machine it isn’t solvable at all.
So if we use a Turing complete language we can implement every possible algorithm.
There are many very real world algorithms that need the infinite states of the Turing machine.
I would also consider Turing completeness a necessary but not a sufficient criterion. As you already pointed out there are a lot of things that are Turing complete but most definitely not programming languages.
Aside from that I think it’s more useful to think of programming language as a description of how a language is used rather than an inherent property of the language. So technically you can express every algorithm in CSS, so you can use CSS as a programming language, but most of the time most people don’t. They use it as a style sheet language.
So even if we let go of the Turing completeness requirement HTML is still not commonly used as a programming language. This also explains why the “front-end is not real programming” sentiment has faded away. Today’s front-end development with its complex UI interactions, client side rendering and so on is quite a different and more involved experience than it was in the earlier days of the web with its static, document like web pages.
So why does it matter? The label of “programming language” creates expectations. Using the term in a manner that is a bit stricter than is technically necessary, is especially useful to beginners navigating this endless ocean of formal languages.
The argument I hear most often in favor of classifying HTML as a programming language, is that not doing so is demeaning to its developers and used to justify lower wages than someone programming in one of the traditional programming languages.
I think you’re right on. Classification of languages like these is based on their design intent and utility. I could theoretically hammer nails with a socket wrench, but why would anyone want to if they had a choice? And it certainly doesn’t mean the tool should be classified as a hammer, just because it’s possible to use it in that way!
When it comes to Turing-completeness, you’re also correct (at least assuming the Church-Turing thesis) that this makes a language universal. Any finite code written in any formal language can be translated into a finite code in a Turing-complete one. The converse is not true.
Of course that doesn’t mean all Turing-complete languages should be considered general purpose programming languages. However, any reasonable definition of a general purpose programming language must at least imply that such a language is Turing-complete, or else there would exist programs that could not be written in that language, which is a major flaw.
The problem with the way this is presented in the article is that the author appears to assume for the sake of argument that if all programming languages are Turing-complete, then all Turing-complete languages must also be programming languages, which is clearly a fallacy.
One thing is to point out is that, today you can do things, that you had to do with CSS and even js that you can do in HTML..
Its a great language!!
depending on a way you look at it you make say it is or isn’t a programming language
what if I say HTML is machine code for machine being layout engine and controls it’s behavior?
on the other hand you can say the layout engine code lies in the firmware and HTML input is merely a config, not code
but does it matter? absolutely not, it does what it’s supposed to (mostly)
Virtual machines can have their own machine code. But HTML is not machine code IMHO – that would stretch the definition of “machine code” too far. But definitely I would object to using the word “fimrware” to mean anything other than code that is stored in the hardware itself as opposed to on general purpose storage. The computer’s BIOS is firmware. It’s operating system, not really.
A better way to approach the question is not to ask “Why HTML is not a programming language?” but to ask “Why would HTML be a programming language in the first place?”
You can’t write a program with HTML. Simple as that. A language cannot be a programming language if it can’t write programs. If making something visible on your screen counts as a program then paint is a programming language because I can paint a stick figure and send the .png “program” to you which you can open with your image reader of choice. Is making a power point presentation programming now as well?
Being turing complete is a good start but that doesn’t alone make a programming language. Minecraft isn’t a language in the first place. That obviously disqualifies it from being a “programming language”
You might as well claim that a bicycle is a motor vehicle. If someone claims that it doesn’t have a motor you answer with “Well a blender has a motor and it’s not a motor vehicle”. Yeah. Because it’s not a vehicle in the first place. Just like HTML isn’t programming and Minecraft isn’t a language. Neither of them are programming languages.
I would not consider HTML consider a programming language as it does not provide control Flotte in the sense of control logic and the possibility of flow as concatenated logic.
But the Iso 2382 is not that strict as it does not demand any logic.
Edit: Flow not Flotte
If Logo is a programming language, then so is HTML. As Zed Shaw once said (this was in regarding CSS): if you are instructing a computer to do stuff, then it’s a programming language.
How make a developer laugh:
“Html is a programming language”
No, HTML is not a programming language!! Stop arguing about it, if it were, we would not be using JS for example.
Is very very simple to understand.
When I say HTML isn’t a programming language, my reasoning isn’t always on what it can do, but what is its purpose. Its purpose isn’t to make logic, but to present data in a way a human can understand. It is basically an XML the browser can interpret and show. CSS also has that purpose and therefore I wouldn’t call it a programming language.
SQL is a more touchy subject. PLSQL definitely has logic, but again, the database purpose is to store data. There shouldn’t be business logic there, so I usually tend to treat it as if procedures and functions weren’t a thing unless extremely necessary.
The article seems to solidify that HTML is not a programming language.
So if we had a specific rigorous definition of what a programming language is we could end this discussion at last.
While many common definitions excludes HTML from the programming language category, this article focuses on the ones that don’t. It’s no surprise many people say HTML is not a programming language but without a common definition of that means it’s meaningless and doesn’t matter. Now why are we debating this again?
Ok, guys, you are clearly a new generation. So listen to the argument of someone from old generation.
Programming language means talk to the machine. Like basic, c++, c#, python, delphi, java, php, and so on.
Html talks to web browser, not the machine.
Java talks to an interpreter, not the machine itself. Does that mean Java is not a programming language?
No, Java talks to a Virtual Machine, which is a machine as well, that uses a JIT to produces machine code
But would you call a HTML page a program?
Really liked the article.
More points to add.
HTML is the only language you can’t skip to make a web. You can do a web without js or css, but not without html
2) people hide their ignorance by attacking html. No semantic tagging, accessibility and utilities it responsive images (picture has logic btw)
I think the problem is that some interpret HTML being a markup language instead of a programming language as devaluing it somehow.
Is it any easier? In some ways yes, in other ways no.
As the article notes at the end, the beauty of HTML is that the basic principles can be learnt with relative ease, but mastering in is actually a long and difficult process.
I think instead of arguing whether HTML is a programming language or not (I think – scientifically speaking – it is hard to argue that it is), it would be better to tackle what the real insuation behind those these remarks, that HTML is either simple or easy (it is neither).
We can debate all day long about whether HyperText Markup Language is or isn’t a programming language (and why it isn’t) but that’s not the real question.
The real question is whether HTML9 BoilerStrap JS* is or isn’t a programming language.
And this is from 2012. Shouldn’t you be using something newer by now?
What confused me about this article is this idea that saying that HTML isn’t a programming language is belittling. I have always described it as a markup language, but I don’t consider that belittling at all. It’s extremely simple to learn and use, and that’s awesome.
To my mind HTML is a series of instructions for a computer to follow to convey the grammatical or structural meaning of data to users.
“Series of instructions for a computer to follow” — At its most basic, that makes it a programming language. And maybe if we started treating it like a programming language instead of ridiculing and demeaning it with this “it’s not a programming language” idiocy, MAYBE we’d have more people learning to use proper semantics with separation of concerns and full/proper accessibility, instead of pissing all over the Internet with mind-numbing idiotic halfwitted TRASH like HTML/CSS frameworks.
Html is a markup languange and cant evaluate or read attributes as you say, is the browser engaine that does things with the html text and evaluates. Is a declarative lenguage yes, it provides semantic structure for a software that uses those data attributes that you mention, but by it self is just a string text.