👀 Live Preview
Markup showing mixed translation behavior (browser translate would skip the first line):
API endpoint: /api/v1/users
Welcome to our documentation. Read the guide below.

The translate attribute is a global HTML feature that controls whether the content inside an element should be automatically translated by browsers and translation tools (such as Chrome’s built-in page translate).
It is especially useful on multilingual sites when you need to protect brand names, product codes, technical terms, or sample text from being incorrectly translated.
Two values.
Any element.
Keep as-is.
Language hint.
boolean prop.
Chrome, etc.
translateThe primary purpose of the translate attribute is to indicate whether an element’s text is eligible for machine translation. By default, translation is enabled (yes), but you can opt out with translate="no" for fine-grained control.
This helps multilingual audiences: most of the page can be translated while critical strings (logos as text, API endpoints, code samples) stay unchanged.
translate hints to automatic tools. For professional multilingual sites, still provide human translations and use the lang attribute correctly.
Add translate to any element with yes or no:
<p translate="no">CodeToFun</p>
<p>This paragraph translates by default.</p>yes (default) or no.translate value.HTMLElement.translate (boolean: true = yes, false = no).lang on <html> or elements for language context.The translate attribute accepts two main values:
yes — Default. Content may be translated by browsers and translation services.no — Content should not be translated (brand names, code, proper nouns).<p translate="no">This paragraph will not be translated.</p>
<p>This paragraph will be translated by default.</p>| Value | Meaning | Use case |
|---|---|---|
yes (default) | Allow translation | Body copy, instructions |
no | Block translation | Brands, code, URLs |
| JavaScript | el.translate = false | Dynamic toggle |
With lang | Language of text | Multilingual pages |
| Scope | Global attribute | Any element |
| Consumers | Browser translate, MT tools | Not all tools honor it |
| Element | Supported? | Typical use |
|---|---|---|
<p>, <span> | Yes | Paragraphs and inline text |
<h1> – <h6> | Yes | Headings (rarely need no) |
<code>, <pre> | Yes | Protect code from translation |
<a> | Yes | Link text or URLs |
| Any HTML element | Yes | Global attribute |
translate vs lang vs manual i18n| Approach | What it does | Best for |
|---|---|---|
translate="no" | Skip auto-translation | Names, code snippets |
lang="fr" | Declares language | Screen readers, hyphenation |
| Separate translated pages | Human-quality copy | Production multilingual sites |
| Browser “Translate page” | Machine translation | User-initiated, respects translate |
Block translation on one paragraph, protect a brand name, and toggle translate with JavaScript.
Markup showing mixed translation behavior (browser translate would skip the first line):
API endpoint: /api/v1/users
Welcome to our documentation. Read the guide below.
Two paragraphs with different translation settings:
<p translate="no">This paragraph will not be translated.</p>
<p>This paragraph will be translated by default.</p>The first paragraph has translate="no", so browser translate features should leave it unchanged. The second paragraph uses the default (yes).
Common real-world pattern on a multilingual page:
<p>
Welcome to <span translate="no">CodeToFun</span> tutorials.
</p>
<code translate="no">console.log("Hello");</code>Only the wrapped brand name and code sample opt out of translation; surrounding sentence text can still be translated.
Toggle translation eligibility at runtime:
<p id="dynamicElement">This text starts with translation blocked.</p>
<script>
document.getElementById("dynamicElement").translate = false;
// Later: element.translate = true to allow translation
</script>The DOM property translate is a boolean. Set false for no and true for yes. The try-it example includes a button to toggle translation on and off.
lang for language — Screen readers use lang, not translate, to pick pronunciation.translate="no" is not a substitute for accessible multilingual UX.yes or no.
Browser feature.
Protected text.
Better UX.
The translate attribute is supported in all modern browsers. Chrome, Edge, Firefox, and Safari honor it for built-in translation features.
Major browsers respect translate when offering page translation.
Bottom line: Safe to use; test with third-party translation plugins because not every tool honors the attribute.
translate="no" on brand names and codelang on the document and foreign-language sectionselement.translate in JavaScripttranslate="no" without good reasontranslate with langThe translate attribute is a valuable tool for controlling automatic translation of specific elements in HTML. With yes and no, you can protect sensitive strings while letting the rest of the page translate freely.
Combine it with proper lang attributes and human translations for the best multilingual experience.
translateBookmark these when building multilingual pages.
Control hint
PurposeDefault yes
Syntaxuse no
Patterntrue/false
DynamicNot replace
i18nyes (default) allows translation; no blocks it.lang, hreflang, and localized content.element.translate = false (no) or true (yes).lang declares language; translate controls whether automatic translation should run.Try the yes/no paragraphs and toggle translate with the button example.
5 people found this page helpful