---
title: "What is the purpose of \"lang\" attribute in HTML"  
description: "What is the purpose of \"lang\" attribute in HTML"  
author: "Steilla Mitchel"  
published: 2024-06-05  
updated: 2024-06-05  
canonical: https://www.mindstick.com/forum/160676/what-is-the-purpose-of-lang-attribute-in-html  
category: "html"  
tags: ["html", "html5"]  
reading_time: 2 minutes  

---

# What is the purpose of "lang" attribute in HTML

What is the [purpose](https://yourviews.mindstick.com/view/247/no-fail-policy-failing-its-purpose) of "lang" [attribute](https://www.mindstick.com/blog/221/attributes-reflection) in [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript)

## Replies

### Reply by Ashutosh Patel

#### HTML “lang" Attribute

The "lang" attribute in HTML is used to specify the primary language of the content within an HTML element or the entire document. Its purpose is to aid in language identification and accessibility, allowing browsers, search engines, and assistive technologies to correctly interpret and process the content.

## Main purposes of the "lang" attribute

## Language Identification

It helps identify the language used in the content, which is essential for internationalization and localization. Browsers and search engines can use this information to provide language-specific features or search results.

## Accessibility

Screen readers and other assistive technologies use the "lang" attribute to pronounce text correctly and provide language-specific enhancements for users with disabilities.

**SEO (Search Engine Optimization**)

Search engines may use the language information provided by the "lang" attribute to improve the accuracy of search results, especially for language-specific queries.

## Example-

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lang Attribute Example</title>
</head>
<body>
    <!-- Example usage of lang attribute -->
    <p lang="en">This is an English paragraph.</p>
</body>
</html>
```

## Output-

```html
This is an English paragraph.
```


---

Original Source: https://www.mindstick.com/forum/160676/what-is-the-purpose-of-lang-attribute-in-html

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
