References

Beginner-friendly references for web development, with live, editable examples.

The HTML translate attribute

Global attribute Works on every element All modern browsers Updated
Quick answer

The HTML translate attribute tells translation tools (such as browser translation and Google Translate) whether to translate an element's content. Use translate="no" to protect text like brand names and code, or "yes" (the default) to allow translation. It is a global attribute.

Overview

The translate attribute signals whether an element's text should be translated when the page is run through automatic translation. The value yes (the default) allows translation; no protects content that must stay exactly as written.

Mark proper nouns, brand and product names, code samples and usernames with translate="no" so they are not garbled by translation. The attribute is inherited, so setting it on a container protects everything inside it. Pair it with the lang attribute for the best results.

Syntax

<p>Built with <span translate="no">CodeShack</span>.</p>

Values

Value
yes | no

Example

Live example
<p>Welcome to <span translate="no">CodeShack</span> — your web development reference.</p>

Best practices

  • Mark brand names, code samples and usernames with translate="no".
  • Do not disable translation of real prose — that defeats accessibility for international readers.
  • Set it on a container to protect everything inside, since the attribute is inherited.
  • Use it together with the lang attribute.

Frequently asked questions

What does the translate attribute do?
It tells translation tools whether the element's content should be translated (yes) or left as-is (no).
How do I stop a word from being translated?
Wrap it in an element with translate="no", e.g. a brand name in <span translate="no">.
What is the default value of translate?
The default is yes — content is translatable unless you opt out.
What should I mark as translate="no"?
Brand and product names, code, usernames and other text that must remain identical in every language.