Home / AI in the Browser / Live Translator

Live Translator in JavaScript, Free with Live Demo

Free live translator in plain JavaScript. Translate as you type in 15 languages with language detection and read aloud, using Chrome on-device AI with an online fallback.

Open live demoDownload HTML fileView code on GitHub
Live Translator JavaScript project: a translator that works as you type, in 15 languages

Runs on: Chrome on-device AI. On-device: Chrome 138 or newer on desktop. Fallback: any browser with internet (limited free daily quota).

What is the Live Translator?

Type or paste text in one language and see it in another as you type. The page also guesses which language you started with, shows how sure it is, and can read the translation out loud.

In recent Chrome it uses the on-device Translator and Language Detector APIs, so translations are private and work offline once a language pack is downloaded. Other browsers use a free online translation service as a fallback.

Good for

  • Chat apps and support tools with global users
  • Travel and study helpers
  • Translating short product or menu text
  • Learning Chrome's built-in AI APIs

What this project does

How it works

  1. Detect the languageLanguageDetector returns likely languages with confidence scores. Without it, the page guesses from the script, such as Bengali or Arabic letters.
  2. Get a translatorTranslator.create() prepares the language pair, downloading it once if needed. Each pair is cached for the session.
  3. Translate on pauseTyping is debounced, so a translation runs half a second after you stop.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

// Which language is this?
const detector = await LanguageDetector.create();
const [best] = await detector.detect("Good morning!");
// { detectedLanguage: "en", confidence: 0.98 }

// Translate English to Bengali on the device
const ok = await Translator.availability({ sourceLanguage: "en", targetLanguage: "bn" });
const translator = await Translator.create({ sourceLanguage: "en", targetLanguage: "bn" });
const text = await translator.translate("Good morning!");

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

Which languages are supported?

The demo includes 15 languages, including English, Bengali, Hindi, Arabic, Chinese, Spanish and French. Chrome downloads each language pair the first time you use it.

Is the translation private?

With Chrome's on-device API, yes. The text never leaves your computer. The online fallback sends the text to the MyMemory service.

How good is the translation quality?

It is good for everyday sentences. For legal, medical or marketing text, have a fluent speaker check it.

More AI in the Browser projects