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")?

  • 1
    If you are using HTML5 then use 2nd option -- the 1st one is now deprecated.
    – LazyOne
    Commented Sep 15, 2011 at 9:23

2 Answers 2


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.

  • 1
    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'
    Commented Sep 15, 2011 at 9:33
  • 1
    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. Commented Sep 20, 2011 at 19:40

HTML 4 and below:

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

HTML 5 +

<html lang="en-us">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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