Why Is HTML Not A Programming Language?

HTML is not a programming language. While some may point out that HTML is a "markup language", this doesn't clarify how that is different from a programming language. I'd like to provide a simple reasoning that is easy to understand by the layperson. (This isn't meant to be a thorough argument, but rather a brief explanation that goes just a bit more in detail than "HTML isn't a programming language but instead a markup language.")

Here is a point I'd like to make: HTML is no more a programming language than Microsoft Word is. With Word (or any other word processor software), you can write out text and format it with different fonts, sizes, and colors. Images and tables and bullet points can be added as well. This is all done through the word processor's graphical user interface.

An HTML file is similar, except it does not have a GUI. Instead, it is entirely written out in plaintext, so all the formatting instructions must be typed out as HTML tags (for example, <b> or <center>.) This "language" of tags is how we can format the appearance of a webpage.

Programming languages, on the other hand, can process data and make decisions. You can store data such as text strings and integers, and then manipulate these values to perform calculations. For example, doing some math or sorting text alphabetically are kinds of data processing that you cannot do in HTML.

Programming languages can also make decisions about what instructions they should execute. Depending on if a certain condition is true or false, a set of instructions may be executed or skipped by a program. Here is a Python example of such code:

if password == 'rosebud':
    print('Access granted.')
    print('Access denied.')

Programming languages also have ways of executing instructions over and over again in loops. Loops, if-else statements, and other such instructions are called flow control statements. All programming languages have these flow control statements, but HTML (and Microsoft Word) do not.

JavaScript is a programming language. It has all these features of flow control and data processing. While JavaScript is used in many web pages, it is a distinctly separate thing from HTML. You can write HTML without JavaScript, and you can write JavaScript code without HTML.

Because HTML lacks these features, it cannot be called a programming language. One does not "program in HTML" nor could one "write HTML code". You should never list HTML on your resume under "programming languages".

The difference is not just a snobbish opinion of elitist software developers. While this post is by no means the definitive and complete reasoning of what a "programming language" is, it is good to know the general difference between a programming language and HTML.

16 thoughts on “Why Is HTML Not A Programming Language?

  1. I hate to be a pedant but I would argue that you're not entirely correct. You are stating a binary distinction where there is in fact a spectrum.

    HTML could be classed as a declarative language - along with regular expressions, SQL and XSLT - and it's actually classed as such on the wikipedia page about 'declarative programming': https://en.wikipedia.org/wiki/Declarative_programming (note that SQL has many extensions that would classify it as a 'proper programming language' even under your definition - but these are not part of the original language which is almost entirely declarative)

    Crudely put - in a declarative language you describe the result you want rather than the process you want the computer to go through to produce it.

    1. I've added some more text to make it clear that I mean this post to be a more brief layperson explanation. My purpose is to explain why a software developer would look at you funny if you said, "I program in HTML."

  2. HTML is a language used in programming web applications so under certain interpretations it *does* count as a "programming language" and since HTML is not plain English, but its tags are a type of code, it's natural to say that you "write HTML code".

    Finally, your choice of HTML tags (b and center) and definition ("how we can format the appearance") are not entirely appropriate or up to date: the primary purpose of HTML is to add structure to a document and to tag semantic elements (so that in conjunction with CSS a webpage can be formatted in a multitude of ways).

    1. Jpegs are used in web applications, but we wouldn't say that jpegs count as a programming language. Writing a blog comment and using HTML tags in it would not be something that people consider "coding". I'm using "code" in the common programming sense, not the technical sense that, say, makes "code" a valid word to use in "American Standard Code for Information Interchange".

      I've added some more text to make it clear that I mean this post to be a more brief layperson explanation. Thanks for bringing up these points though.

    2. No, you're wrong.

      HTML is only a container structure containing data, sometimes formating if not used with CSS, and this data container structure is used by a View (Browser, etc) to show a representation of the data in the HTML structure to the user.

      HTML is not more a programming language than XML and event XAML.

    3. HTML is like the old WordPerfect syntax for formatting texts… Word do the same formatting syntax under the hood but don’t show it to user.

      Do you consider a word document you saved on your computer is a programming language? Probably no… Do you know that .docx Word documents are saved in XML which is a variant of HTML?

      So XML is not a programming language… as HTML is near the same technologies than XML it means that HTML is not a programming language… Simple…

      Its like telling that a Technical Redactor that get a contract to write a car repair guide is a mechanician… No, the redactor only put info about mechanics in a book. The person that refer to this book to repair a car is the mechanician.


  3. JPEGs are not a programming language because JPEGs are not a language in the first place, they're a media or image file format, but HTML *is* a language, granted, a markup language. Writing a blog comment with HTML tags doesn't qualify as "coding" because it's a very small sample and you're usually limited in the types of tags you use.

    However, someone who writes a full web page in HTML, or in some HTML-like template language, like Jinja, is "coding" because they're following a certain structure, or the resulting page will be incomprehensible or useless. So HTML may not be a language to communicate processing or decision-making instructions to a computer, but "programming language" can have a broader interpretation (is someone punching a tape for a player piano programming? what about a punched tape for a Z80 micro?).

    Nevertheless, anyone claiming in a CV to have done "HTML programming" isn't going to get great marks on a job interview.

  4. HTML has types, it instructs a virtual machine what to do.

    Your password example in html5 can be done with type="password" input element. It can also have the required attribute added, which makes sure the field is used. As well, you can define a regex in the pattern attribute which checks the syntax of the password.

    Even if you pretended JavaScript didn't exist, you surely couldn't remove things like data attributes, or styles from HTML. Since HTML + CSS is Turing Complete by itself.

    HTML5 includes the DOM API, and other programming APIs.

    I know this isn't true in the Original Authors case... but the meme of what is and isn't a programming language comes up in more insidious forms. The idea that "Real men" use "real programming languages" comes up often in the industry. For some reason the work that "designers" do isn't programming, it's some sort of lower work. Even though they are creating instructions which make a computer do something with highly advanced programming interfaces. Why is form and user interface behaviour not as important as function? Why isn't visual communication of what the computer is doing as important as comparing one string to another?

    Anyone who claims to do HTML programming on a CV would definitely get an interview for one of the many HTML programming jobs out there. Anyone who said HTML is not a programming language would be technically wrong. The worst kind of wrong.

    End of.

  5. Hey Al, That's an interesting view on HTML. Whether HTML is technically a programming language is hard to decide but, as Joe has pointed out, if you're looking for a job then it would be better to put it on your CV as of now.

  6. I think that what you actually meant, Al, is that HTML is not a turing complete language.

    Even if you had said that it would only have raised the character of this post from wrong to banal.

  7. Lee, thank you for commenting on my banal post. I would have thought it too insignificant for your time, but apparently it is.

    A more general reply: I'm very much opposed to the machismo of the tech industry and did not intend for this post to align itself with that, hence the "this is not just a snobbish opinion".

    HTML should most definitely be listed on a resume to get past HR filters, I agree. I'm saying that labeling it under "programming languages" would raise eyebrows.

    Also, if HTML can be considered a programming language, how about XML? JSON? BBcode? Is the JPEG file format specification just a DSL for generating images?

  8. Further update: I meant this to be a layperson article. There are many tributaries you can go down if you want to get to technical specifics. I have answers for them, but opted not to explore them in this post to keep it simple.

  9. As a layperson, I appreciate you taking the time to make an elementary distinction between what HTML is and what a 'programming language' is generally thought of as being. In contrast to the differing opinions above, I believe that to make this characterization is not entirely incorrect in the context of lay-understanding.

    There is a reason they don't teach calculus in elementary school: at the elementary level of understanding there are more important general concepts to mentally digest than how to integrate a function. Likewise here, you have drawn a distinguishing line for those of us who do not have the background and, therefore, the capability (at present) to differentiate between HTML and its typical implementations and scope vs., say, Python and its typical implementations and scope.

    Drawing this distinction for the "noob" is important because it prevents us from those cringe-worthy moments reminiscent of tv moms lecturing their teens about the dangers of "the drugs and the crack". In the example above, you specifically mention resumes which is even more important for the amateur looking to strike out on their own in the software development world.

    In summary, its easy to nitpick the hell out of someones attempt to speak in generalities or to summarize. However, if anything, the ability to abstract the concepts of a 'programming language' to a broader sense of the term and then compare/contrast that with an abstraction of HTML and its general sense is key for someone whose goal is to instruct, especially for the beginners. So for everyone with the technical background to point out every little detail and why its wrong: he isn't talking to you.

  10. :) i did a bit of research and yes html+css is turing complete (http://eli.fox-epste.in) so you could in principle code any program in html+css. it would be difficult and pointless, but it could be done. that makes html(+css) a programming language.
    having said that, i doubt that anyone that claims to have done programming in html in their cv would understand what i've discussed here though.

  11. Thanks for this explanation of the differences between the two. As much as real programmers would like to correct you on the "technical" difference between the 2, they fail to realise that you're trying to explain this to a lay person who doesn't understand much about programming.

    I don't know squat about programming, so you're really helped me understand the difference between HTML and python.


Leave a Reply

Your email address will not be published. Required fields are marked *