The HTML attribute that specifies the natural language of an element’s content is lang.
It is written in the opening tag, such as <p lang="fr">Bonjour</p>. The value normally uses a language tag, often an ISO 639 language code such as en, fr, or de, optionally followed by a regional subtag such as en-US or pt-BR. Language information can be inherited: setting lang on the <html> element establishes a default for the document, while a nested element can override it.
The attribute helps screen readers select pronunciation rules, supports hyphenation and spell-checking, and gives browsers and search tools useful linguistic metadata. It does not set text direction; that job belongs to dir, whose values include ltr and rtl.
charset identifies a document’s character encoding, not its spoken language. xml:lang serves a related purpose in XML and XHTML contexts, but for ordinary HTML the canonical answer is lang. XHTML 1.0 guidance commonly recommended using both attributes when compatibility with XML processing mattered.