Home / AI in the Browser / Smart Writing Assistant

Smart Writing Assistant in JavaScript, Free with Live Demo

Free AI writing assistant in plain JavaScript. Draft text, rewrite it more formal or casual, and get a live readability check for long sentences and passive voice.

Open live demoDownload HTML fileView code on GitHub
Smart Writing Assistant JavaScript project: a writing helper that drafts, rewrites and checks your text

Runs on: Chrome built-in AI and your CPU. AI writing: Chrome 138 or newer with the Writer, Rewriter or Prompt API turned on (chrome://flags or an origin trial). Writing check: every modern browser.

What is the Smart Writing Assistant?

This is a small writing tool for everyday text like emails, posts and product pages. It can write a first draft from a short prompt, rewrite what you have in a different tone, and check how easy your text is to read.

The drafting and rewriting use Chrome's new built-in Writer and Rewriter APIs, which run on the device. The writing check works in every browser. It scores reading ease and highlights long sentences, passive voice and filler words right in your text.

Good for

  • Email and message drafts
  • Product descriptions and blog intros
  • Checking that copy is easy to read
  • Adding writing help to your own app

What this project does

How it works

  1. Pick the best engineThe page checks for the Writer and Rewriter APIs first, then the general Prompt API, and says which one it found.
  2. Generate or rewriteYour text and options go to the on-device model. Nothing is sent to a server.
  3. Check the resultEvery edit runs the local writing check, so you see the reading score change as you type.

The key JavaScript

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

// Draft new text
const writer = await Writer.create({ tone: "neutral", length: "short", format: "plain-text" });
const draft = await writer.write("An email moving the launch to Wednesday");

// Change the tone of existing text
const rewriter = await Rewriter.create({ tone: "more-formal", length: "as-is" });
const formal = await rewriter.rewrite(draft);

// No Writer or Rewriter? The general Prompt API can do both
const session = await LanguageModel.create();
const reply = await session.prompt("Rewrite this more formally: " + draft);

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

What is a good reading ease score?

Most readers are comfortable with a score of 60 or higher. News sites aim for 60 to 70. If your score is under 50, try shorter sentences and simpler words.

Does the writing check send my text anywhere?

No. The readability check is plain JavaScript on the page, and the AI features run on the device through Chrome.

Why is the AI part not working in my browser?

The Writer and Rewriter APIs are new and only in recent Chrome versions, sometimes behind a flag. The writing check still works everywhere.

More AI in the Browser projects