The lang= attribute in HTML

One small step for a coder, a big leap for blind users

There is one very small change to your HTML that might help international users of your site that rely on speech synthesis to read your site. The HTML lang= attribute.

The story

Non-native english speaking blind people have their default speech language typically set to their native language. When they end up browsing to a site in english (or any language other than their native one for that matter) the screen reader starts to read english with pronounciation from their native language. While some people start to understand such speech output after a while, it is really a pain to work with. Of course, you can switch to a different speech language manually, but that takes time, and people end up not doing it in a lot of situations.

Some screen readers have automatic language detection implemented, but it fails to work correctly in many cases, which is why most users have autodetection actually turned off.

The simple fix

Use the lang= attribute to declare what language your document (or parts of your document) uses.

A lang= attribute on the top-level <html> tag will let screen readers know what the default language of this document is.

This is a very simple change that you might be able to do in a few seconds/minutes, depending on what framework you use.

Please consider declaring your document language, it will make the overall experience of surfing the net for non-english blind users a lot nicer.


I am writing this article because I got frustrated with Hacker News not declaring lang="en". Whenever I visit the site, I get all the content read with a german speaker.

However, HN is definitely not the only bigger site that gets this wrong.

Please check your projects

If you are maintaining websites, please take the time and check if you are declaring the document language. If not, please consider adding this very small change to your site.

Guess that key

A few years ago, I created a small web game to demonstrate what sort of wrongly-pronounced words you have to deal with as a blind user if speech language settings do not fully work.

You can find it here.



Github Activity