The 24 Boolean Attributes of HTML

Post from May 19, 2020 (↻ October 22, 2022), filed under (feed).

There are Boolean attributes in HTML and, unless I err somewhere, there are two dozen of them. Here’s a quick rundown of what makes for a Boolean attribute, and what Boolean attributes there are in current HTML.

What is a Boolean at all? Citing the The Web Development Glossary, a Boolean is “a data type that has one of two possible values (usually denoted true and false).”

What is a Boolean attribute? A Boolean attribute is an attribute that can only be true or false.

How does a Boolean attribute work? According to the HTML specification:

The presence of a boolean attribute on an element represents the “true” value, and the absence of the attribute represents the “false” value.

Yet note:

The values “true” and “false” are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

So, what Boolean attributes are there?

The Boolean Attributes

  1. allowfullscreen
  2. async
  3. autofocus
  4. autoplay
  5. checked
  6. controls
  7. default
  8. defer
  9. disabled
  10. formnovalidate
  11. inert
  12. ismap
  13. itemscope
  14. loop
  15. multiple
  16. muted
  17. nomodule
  18. novalidate
  19. open
  20. playsinline
  21. readonly
  22. required
  23. reversed
  24. selected

Yes. That’s it.

Update (October 21, 2022)

The list now strictly follows the HTML specification’s attributes overview. That means it doesn’t contain Boolean attributes found on legacy and obsolete elements anymore, like truespeed.

Toot or tweet about this?

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!