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.
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
- Write a draft from a prompt with tone and length options
- Rewrite text more formal, more casual, shorter or longer
- Live writing check: reading ease score, reading time, long sentences, passive voice and filler words
- Highlights problems right in your text
- Falls back to the Prompt API when Writer or Rewriter are missing
How it works
- Pick the best engineThe page checks for the Writer and Rewriter APIs first, then the general Prompt API, and says which one it found.
- Generate or rewriteYour text and options go to the on-device model. Nothing is sent to a server.
- 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
- Click Download HTML file above.
- Open the file in a code editor, like VS Code.
- Run it from a local server with
npx serve .so the camera, microphone and AI features are allowed. - 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

001. Local AI Chatbot
A private chat assistant that runs on your graphics card
002. Image Classifier
Drop a photo and see what the AI thinks it is
003. Speech to Text Notes
A voice notes app that writes down what you say
004. AI Text Summarizer
Paste a long article and get the key points
006. Live Translator
A translator that works as you type, in 15 languages