HTML translate Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The translate global attribute is an enumerated attribute. It tells localization tools whether an element’s text nodes and translatable attribute values should be translated when the page is localized — or left unchanged.

Use translate="no" for brand names, product names, and code. Pair it with lang (language of the content) and related globals like dir and title.

Baseline · Widely available.

Not deprecated and not experimental. Browser recognition is widely available since about March 2023. Automatic translators such as Google Translate already respect translate="no".

Not CSS transform: translate().

The HTML attribute controls localization. The CSS function moves elements on screen — unrelated APIs that share a name.

HTML Syntax

syntax.html
<element translate=" yes|no|">

Empty string (translate="") or yes means translate. no means do not translate. In JavaScript, element.translate is a boolean IDL.

Attribute Values

Only these enumerated values:

ValueDescriptionTry it
yesElement should be translated when the page is localizedTry it
"" (empty)Same as yes — allow translationTry it
noMust not be translated (brands, code, fixed names)Try it
Nested noProtect a name inside otherwise translatable textTry it
JS .translateBoolean reflecting the attributeTry it

Live Preview

Toggle translate on the brand span. The text stays the same; the attribute (and IDL) update for study.

translate

Real page translation needs a tool (browser translate, Google Translate). This preview shows the markup intent.

Sample

© 2026 CodeToFun

translate="no" · element.translate = false

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Protect a Brand Name

Ask translation tools not to rewrite the company name in a footer.

HTML
<footer>
  <small>© 2026 <span translate="no">BrandName</span></small>
</footer>
Try It Yourself

How It Works

  1. Wrap the fixed name in a <span> (or other element).
  2. Set translate="no" on that element.
  3. Surrounding text can still translate — only the marked node is protected.
  4. Tools honor the hint when the page is localized automatically or by hand.

Example 2 — Sentence + Fixed Product Name

Keep a product name stable inside otherwise translatable copy.

HTML
<p lang="en">
  Download
  <strong translate="no">PixelKit</strong>
  for Windows and macOS.
</p>
<p>
  Example command:
  <code translate="no">npm install pixelkit</code>
</p>
Try It Yourself

How It Works

  1. Default is to allow translation for normal prose.
  2. Mark names and code with translate="no".
  3. Use lang for the language of the sentence.
  4. Nested override — children can differ from parents.

Example 3 — Read and Set with JavaScript

The IDL property element.translate is a boolean.

HTML
<p id="label">Hello <span id="brand" translate="no">Acme</span></p>
<button type="button" id="toggle">Toggle translate</button>
<p id="out"></p>

<script>
  var brand = document.getElementById("brand");
  var out = document.getElementById("out");

  function show() {
    out.textContent =
      'attr=' + brand.getAttribute("translate") +
      " · IDL translate=" + brand.translate;
  }

  document.getElementById("toggle").addEventListener("click", function () {
    brand.translate = !brand.translate;
    show();
  });

  show();
</script>
Try It Yourself

How It Works

  1. getAttribute("translate") returns the content attribute string.
  2. element.translate is true when translation is allowed.
  3. Assign the boolean to flip between yes and no in the DOM.
  4. Still a hint — a translator must run for visible language change.

Edge Cases & Pitfalls

Most confusion is expecting the browser to rewrite text instantly, or mixing this up with CSS.

hint

It does not auto-rewrite the page

Marking content only guides translators. Until a tool runs, the on-screen language stays the same.

vs CSS

Not transform: translate()

CSS translate moves boxes. The HTML attribute is for localization only.

attributes

Covers translatable attributes too

Tools may also skip translating attribute values on elements marked no (for example some title / alt cases) — follow the HTML “translatable attributes” rules.

inherit

Nest carefully

A child can override a parent. Put no on the smallest element that must stay fixed.

lang

Still set lang

lang is for pronunciation and language identity. translate is only about whether to rewrite during localization.

Browser Support

translate is an HTML global attribute. Translation engines and localization tools are the main consumers; browser UI may not visibly change text by itself.

✓ Baseline · Widely available

translate

Widely available in browsers since about March 2023. Chrome, Firefox, Safari, Edge, and Opera expose the attribute / IDL. Tools like Google Translate honor translate="no".

95% Global support (approx.)
Google Chrome 19+
Full support
Mozilla Firefox 111+
Full support
Apple Safari 6+
Full support
Microsoft Edge 79+
Full support
Opera 15+
Full support
Samsung Internet Modern · Full
Full support
Internet Explorer No
Not supported
translate Widely supported

Bottom line: Safe to use for brands and code. Mark fixed strings with translate="no" even if you also ship separate locale files — browser translate features and MT tools benefit.

Key Takeaways

  • Role: hint whether text should be translated during localization.
  • Values: yes / empty = translate; no = leave unchanged.
  • Protect: brands, product names, and <code> snippets.
  • Pair with: lang for language identity; not CSS transforms.

One line: use translate="no" on strings that must stay as-is when the page is translated — especially brand names and code.

Frequently Asked Questions

It is a global enumerated attribute that tells localization tools whether an element’s text and its translatable attribute values should be translated (yes or empty) or left unchanged (no).
For brand names, product names, code snippets, usernames, and other strings that must stay in the original language when the page is translated.
yes or the empty string means translate. no means do not translate. It is an enumerated attribute, not a free-text field.
Usually no. translate is a hint for automatic translators (such as Google Translate) and human localization tools. The visible page does not morph until a translator runs.
lang declares the language of the content. translate decides whether that content should be rewritten during localization. Use both: lang on the page, translate="no" on fixed names.
No. It is a standard HTML global attribute and Baseline widely available (browser recognition since about March 2023). Translation tools have respected translate="no" for longer.

Next: type

Specify the type of inputs, buttons, scripts, and other elements.

type tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful