Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There seems to be two ways to specify the language of a page:

<meta http-equiv="Content-Language" content="en-us">


<html lang="en-us">

Which one is the preferred way? I know I could just add both tags but I'd rather not have duplicate content.

Also do both methods use the same locale format (i.e. "en-us" and not "en_US")?

share|improve this question
If you are using HTML5 then use 2nd option -- the 1st one is now deprecated. – LazyOne Sep 15 '11 at 9:23

The second one is the preferred way. http://www.w3.org/TR/html5/semantics.html The first one is "non-conforming". I couldn't find an exact definition of what that means, but I think it means, "it may work, but you can't rely on it".

They both use the format defined in BCP47, which uses a dash, not an underscore.

share|improve this answer
Actually, HTML4(and XHTML) uses RFC1766 for language formats. I don't have the inclination right now to see if/how different those really are, but adding for the sake of the technical note. – Su' Sep 15 '11 at 9:33
It should also be noted that Google actually ignores your language specification and instead auto-detects the language. See answer here from a Google employee. – DisgruntledGoat Sep 20 '11 at 19:40

HTML 4 and below:

<meta http-equiv="Content-Language" content="en-us">

HTML 5 +

<html lang="en-us">
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.