Screenshot to Code — AI UI Converter
Turn UI screenshots into HTML/CSS, Tailwind or React with your own Gemini API key, or build a colour-matched starter layout in your browser without one.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
Screenshot to Code — AI UI Converter
Turn UI screenshots into HTML/CSS, Tailwind or React code with your own Gemini API key, or build a colour-matched starter layout without one; live device preview, split compare and ZIP export.
Screenshot to Code turns a UI screenshot or mockup into an editable HTML/CSS, Tailwind or React project. Without an API key it runs in Local Canvas Mode: your browser samples the screenshot's colours and horizontal layout bands and fills a starter template with them, so you get a colour-matched scaffold rather than a copy of the layout. With your own Google Gemini API key, saved in this browser, the screenshots and your instructions go from your browser to Google's Gemini API at generativelanguage.googleapis.com, which writes the code and applies AI edits. You then edit the files in a Monaco editor, preview them in a sandboxed frame, compare them with the screenshot and download a single HTML page or a project ZIP.
How to use Screenshot to Code — AI UI Converter
- 1
Drop, browse or paste up to five PNG, JPG or WEBP screenshots into the uploader, or click Try Sample Screenshot.
- 2
Choose HTML / CSS, Tailwind or React JSX and, if you like, type instructions for the layout.
- 3
Click Generate Starter Layout to build a colour-matched starter in your browser, or add a Gemini API key in Settings and click Generate code to have Gemini write it.
- 4
Check the Preview tab at Desktop, Tablet (768px) and Mobile (390px) widths, edit files in the Code tab and line the result up with the screenshot in the Compare tab.
- 5
Open Export to download a single file, a self-contained HTML page or the full project ZIP.
Why use Screenshot to Code — AI UI Converter
Starter layouts without an API key
Local Canvas Mode samples real colours, the aspect ratio, overall brightness and horizontal bands from your screenshot in the browser and fills an HTML/CSS, Tailwind or React starter template with them.
Gemini code generation with your own key
Add a Google Gemini API key in Settings and Gemini writes the files from your screenshots and instructions, then applies edits, section rewrites and visual fixes to the code you send it.
Sandboxed live preview
Generated code runs in an iframe sandboxed without same-origin access, at full width, 768px tablet or 390px phone size; React files are compiled inside that frame by Babel.
Monaco editor & version history
Edit each file with syntax highlighting, undo and redo, and keep up to 50 saved versions per project in this browser's IndexedDB.
Side-by-side & overlay compare
Check spacing and proportions by placing the screenshot beside the rendered page with a draggable divider, or over it with adjustable opacity.
Single-file HTML & ZIP export
Download one file, a self-contained HTML page, or a ZIP with the source, a preview page, the reference screenshots and, for React, a Vite project setup.
Common use cases
- Rebuild a landing page, dashboard or component screenshot as editable HTML/CSS, Tailwind or React code with Gemini.
- Start a page in a reference image's palette: the canvas analysis pulls its background, surface, accent and text colours and its section bands.
- Check generated code against the original screenshot with the draggable split divider or the opacity overlay.
- Hand off a prototype as a ZIP with the source files, a standalone preview page and the reference screenshots.
Frequently asked questions
Do I need an API key to use Screenshot to Code?
Not for the starter layout. Local Canvas Mode runs in your browser and builds a colour-matched starter template from the screenshot's colours and layout bands, which you can edit, preview and export; it does not reproduce your exact layout. To have AI write code from the screenshot, or to use the AI edit modes, add your own Google Gemini API key in Settings.
Where is my Gemini API key stored, and what is sent to Google?
The key is saved only in your browser's localStorage under stc_gemini_api_key. When you generate, analyse or run an AI edit, your browser sends the screenshots, your instructions and, for edits, the current code straight to Google's Gemini API with that key. Nothing passes through AltFTool's servers, and Google's terms apply to what you send.
Which frameworks and files are supported?
You can generate and switch between HTML + CSS (index.html, styles.css, script.js), HTML + Tailwind CSS (index.html, script.js), and React 18 JSX (App.jsx, styles.css).
How does React JSX render in the live preview without a server?
The preview frame loads React 18 and @babel/standalone from unpkg.com, compiles App.jsx inside that sandboxed frame and lists any syntax or runtime errors under the preview.
Are my screenshots and code saved between sessions?
Yes, in this browser only. Projects, reference screenshots, code files and up to 50 version snapshots are kept in IndexedDB, and Clear data in Settings deletes them.
Why does Capture from URL ask me to paste a screenshot instead?
The tool has no server of its own to load other websites, and most sites cannot be captured from another page in your browser, so it cannot take the screenshot for you. Take one with your system's screenshot shortcut and paste it with Ctrl+V or Cmd+V, or upload the file.