How to Take Screenshots and Render HTML/CSS with ChatGPT and Codex
Attach a screenshot, generate or edit HTML/CSS, and review the rendered result with ChatGPT or Codex. Here’s how to choose the right workflow and troubleshoot it.

To use a screenshot as a design reference or bug report, attach it to a ChatGPT conversation or provide it to Codex, then describe what you want changed. For a quick example, ask ChatGPT to write HTML/CSS and use Preview on the supported code block if that action is available. For an existing project, use Codex to make the changes, inspect the rendered page in a browser, and iterate from what you see.
The key distinction is the work you need done: ChatGPT is convenient for discussing an image and trying an isolated snippet; Codex is suited to editing a project and checking the result in context. The exact controls depend on your product surface, account, plan, workspace settings, and feature rollout.
1. Capture a screenshot that answers the right question
Start with a screenshot that shows the relevant part of the page clearly. Include the entire component or page region involved, rather than a tight crop that hides spacing, surrounding layout, or the source of a bug. If responsive behavior matters, capture the desktop and mobile states separately and label the viewport dimensions in your prompt.
ChatGPT accepts image input through the plus menu, drag-and-drop, or pasting a copied image. The image-input FAQ lists PNG, JPEG, and non-animated GIF, with a 20 MB maximum per image. The number of images you can include can depend on file size and accompanying text. See the ChatGPT image inputs FAQ for current limits.
A screenshot is evidence of appearance, not a complete specification. It may not show hover states, interaction rules, hidden content, or the original layout constraints. Tell the model what the image represents and what should happen in states that are not visible.
Give the image a clear role
Say whether it is a design reference, a bug report, or the current state you want improved. Then describe the target viewport, expected behavior, and output you want. For example:
This screenshot is a design reference for a pricing card component.
Create a responsive, single-file HTML example with embedded CSS.
Match the spacing, typography hierarchy, border, and button placement.
At widths below 600px, stack the cards vertically. Use semantic HTML
and do not add JavaScript. Explain any visual details the screenshot
cannot establish.
For a bug report, state what you expected and what actually happened. If you already know the affected browser or viewport, include it. If the screenshot contains personal information, credentials, or private customer data, crop or redact that material before uploading.
2. Render an HTML/CSS example in ChatGPT
For a small, self-contained page or component, ask ChatGPT for the code in a supported code block. When a Preview action appears, select it to view the result inside ChatGPT. OpenAI documents previews for supported code blocks, including HTML pages, React components, SVG, Mermaid, and chart formats. The action may not be available in every conversation; availability varies with plan, device, workspace settings, model, and rollout. Consult the code-block guidance for current details.

Here is a complete prompt for a first pass:
Build a responsive page based on the attached screenshot.
Return one complete HTML document with embedded CSS so I can preview it.
Use the screenshot as a visual reference, not as proof of behavior.
Preserve the content hierarchy and approximate spacing. At 390px wide,
make the layout readable without horizontal scrolling. Use CSS only.
After the code, list the details you had to infer.
Review both the code and the preview. Check whether the structure is semantic, the text is accurate, and the layout adapts at the requested width. If something is wrong, give a specific correction: identify the element, describe the visible problem, and state the desired result. “Make it better” gives less direction than “Reduce the gap between the heading and the first card to match the reference.”
For example, this standalone document can be saved as index.html and opened in a browser if you want to inspect it outside ChatGPT:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Screenshot reference example</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 2rem;
color: #17212b;
background: #f3f5f7;
font: 16px/1.5 system-ui, sans-serif;
}
main {
max-width: 42rem;
margin: 3rem auto;
padding: 2rem;
border: 1px solid #d7dde3;
border-radius: 1rem;
background: white;
}
h1 { margin-top: 0; line-height: 1.15; }
a { color: #075bb5; }
@media (max-width: 600px) {
body { padding: 1rem; }
main { margin: 1rem auto; padding: 1.25rem; }
}
</style>
</head>
<body>
<main>
<h1>A page to inspect</h1>
<p>Compare this layout with your reference at the target viewport.</p>
<a href="#details">Review the details</a>
</main>
</body>
</html>
The sample is intentionally small. Your own prompt should specify the content, component states, and responsive requirements relevant to the screenshot.
3. Use Codex when the change belongs in a project
When you need to edit an existing frontend, provide the screenshot as design context or evidence of a UI bug and ask Codex to change the relevant files. Codex can use a browser workflow to examine what it built, iterate, and attach a result screenshot where supported. OpenAI describes sharing images to communicate frontend design specifications or explain UI bugs in its Codex announcement.
A focused project request might read:
Use the attached screenshot as the reference for the checkout summary.
Inspect the existing app and find the component responsible for this panel.
Update the component and styles to match the reference at 1440px and 390px.
Keep the existing design tokens and behavior. Run the app and inspect the result
in a browser if that workflow is available. Report the files changed and any
visual details that remain uncertain.
Keep the request bounded: identify the page or component, viewport, expected behavior, and any constraints such as preserving design tokens or accessibility. Ask Codex to inspect the result after editing, then compare the screenshot it produces with the reference. If it cannot access the local page or browser, use your normal development server and browser and give Codex the resulting screenshot.
Turn visual feedback into a targeted edit
On supported ChatGPT desktop browser workflows, Annotation mode lets you select an area of a rendered page and leave a comment about it. This is useful when “the right side looks off” is too vague: select the area and say what is misplaced or how it should behave. The built-in browser has separate browser state and is available in the ChatGPT desktop app on macOS and Windows; supported features and website access depend on plan and workspace policy. See the browser guide for current availability.
Choose the browser surface based on the state the task needs. The built-in browser has its own state. If the page depends on your current Chrome profile, signed-in session, open tabs, or extensions, the Codex Chrome extension may be the appropriate route when available. Before using a signed-in site, confirm which account and session are active.
4. Choose ChatGPT preview or Codex
| Need | ChatGPT code preview | Codex project workflow |
|---|---|---|
| Best fit | Quick HTML result or isolated example | Change an existing frontend and review it in context |
| Screenshot role | Attach or paste an image into the conversation | Provide a design reference or UI bug evidence; available app tools may attach a window and text |
| Review loop | Preview a supported code block when the action is present, then request revisions | Inspect the page in a browser, iterate, and review a screenshot where supported |
| Access limits | Preview actions vary by plan, device, workspace, model, and rollout | Client, browser, workspace policy, permissions, and rollout affect available controls |
Use the smallest workflow that can answer the question. A static component can start in preview. A project-level bug usually needs the actual app, its styles and state, plus browser inspection. If a feature mentioned in instructions is missing, check current product controls and workspace policy before changing your approach.
5. Debug the rendered page when visual review is not enough
A screenshot can reveal that a page looks wrong, but it rarely identifies why. If the problem depends on JavaScript state, a failed request, or runtime errors, ask for deeper inspection only after reproducing the issue. OpenAI’s developer mode can give Codex controlled CDP access to inspect console output, network traffic, page state, and JavaScript performance. It requires configuration, and Codex asks for explicit approval before full CDP access. Details are in the Codex documentation.
For a useful debugging report, include the action that reproduces the issue, expected and actual behavior, the affected route and viewport, and any relevant console or network error. Avoid asking for a broad rewrite when a small reproducible failure can be isolated. Inspect the proposed code changes and confirm they preserve the intended interaction and responsive behavior.
6. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| The image will not upload | Unsupported format, file too large, or upload control unavailable | Use PNG, JPEG, or non-animated GIF; keep each image at or below 20 MB; try the plus menu, drag-and-drop, or paste. |
| There is no Preview action | The block or current product surface does not offer preview | Confirm the response is a supported HTML or other previewable block. If the action is still absent, save the code and open it locally. |
| The preview does not match the screenshot | The screenshot leaves details ambiguous, or the prompt omits viewport and layout constraints | State the viewport, identify the mismatched element, and request a specific correction. Add another screenshot for a distinct responsive state. |
| The page works in preview but not in the project | The isolated snippet lacks project styles, assets, routing, fonts, or runtime data | Ask Codex to inspect and modify the actual project component. Check the browser console and network requests if the mismatch remains. |
| Codex cannot see the page | The app, browser integration, local server, or workspace permission is unavailable | Start the app using its normal development command, confirm the route loads in your browser, and provide a capture or use an available supported browser workflow. |
| The page looks different while signed in | The browser sessions have different cookies, account state, extensions, or local data | Use the intended browser profile and account deliberately. Report the state needed to reproduce the screenshot, without exposing credentials. |
| A visual bug has no obvious cause | The screenshot shows the result but not console, network, or runtime state | Reproduce the bug and inspect console and network details. Use controlled CDP access only when configured and approved. |
7. Reliability, performance, and access considerations
For a dependable visual comparison, keep the viewport, browser state, route, and input data consistent between captures. Dynamic content, delayed fonts, animations, rotating banners, and personalized pages can change between runs. Record the state you expect and, for project work, ask the agent to inspect the actual rendered page rather than treating generated source code as proof that the layout works.
Start with a static preview for a simple example and use browser or developer inspection when the question depends on runtime behavior. This keeps the investigation proportional to the problem. No performance result follows from the tools’ availability alone; measure your own page under the conditions that matter to your application.
Image upload, browser access, annotation, and publishing controls can depend on plan, platform, region, workspace policy, and feature rollout. Product eligibility can change. For example, the current plan guide describes Sites eligibility with plan and regional restrictions, and workspace administrators control creation and public publishing. Check the current plan documentation and relevant feature controls rather than assuming a control is universal.
Or skip the browser setup
If your goal is a clean screenshot of a public website, ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Its API returns an image or PDF from one GET request; its MCP tools let AI agents take screenshots, get page information, and capture PDFs. See the ScreenshotNeo documentation for the API and options.

curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://stripe.com \
-o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
with open("shot.webp", "wb") as image:
image.write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://stripe.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
ScreenshotNeo accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses identify the page verdict and billing status in X-Page-Verdict and X-Billed headers. An MCP server lets AI agents, including Claude and Cursor, use its screenshot tools. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.
For a one-off call, you do not need to install or configure a browser automation stack. The API also supports full-page and element captures, device presets and custom viewports, dark mode, custom CSS and JavaScript, wait conditions, request blocking, headers and cookies, PDF output, caching, signed image links, asynchronous jobs, bulk capture, and usage reporting. The documentation lists parameter names shared with other screenshot APIs to ease migration.
Sign up free for 1,000 screenshots a month, with no card required.
FAQ
Can I give ChatGPT a screenshot and ask it to recreate the page?
Yes. Attach the image and ask for a bounded implementation, including viewport and responsive requirements. Review the output because the image may not reveal behavior or hidden layout rules.
Does every HTML answer have a Preview button?
No. Preview is available for supported code blocks when the action is present. If you do not see it, save the code and render it in a browser.
Should I use the ChatGPT browser or Chrome?
Choose based on the state required. The built-in browser has separate state; a Chrome workflow may be needed for your current profile, signed-in session, tabs, or extensions when supported.
Can Codex make a change from a screenshot alone?
A screenshot can guide a change, but project context and a rendered review help establish whether the result works in the app. Provide the target files or page behavior when you know them.
Can I publish a site made with ChatGPT or Codex?
Publishing controls and eligibility vary. Check the current plan and workspace settings; administrators may control whether a site can be created or publicly published.


