Large Language Models

Opan AI Codex Make CSS From Images: Prompts, Examples, and Free Options

Hand a screenshot, a mockup, or a photo of a layout to OpenAI Codex and get working CSS back. This article shows the exact prompts, three worked examples, the free access that exists today, and free alternatives on PicassoIA.

Opan AI Codex Make CSS From Images: Prompts, Examples, and Free Options
Cristian Da Conceicao

You have a screenshot of a page you like, or a mockup from a designer, and you need the CSS by the end of the day. Typing every margin, shadow and grid column by hand is slow. That is why so many people search for Opan AI Codex make CSS from images (the product is spelled OpenAI Codex) and hope the tool can read a picture and hand back a stylesheet. It can, within limits, and the result depends far more on your prompt than on the tool.

This article shows what Codex does with an image, the prompts that give clean CSS, three worked examples, what free access looks like right now, and where to go if you want free alternatives that run in your browser.

💡 Quick answer: Upload the image, tell Codex the stack you use (plain CSS, Tailwind, CSS modules), name the breakpoints, and ask it to compare its render with your image. Those four instructions fix most bad output.

What Codex Does With Images

OpenAI Codex is a coding agent. You give it a task, it reads your project files, edits them, and runs commands. Because it accepts image input, you can attach a screenshot to that task and say "make the page look like this."

Image input in plain terms

The model looks at your picture the way a person would glance at a design comp. It picks out the header bar, the hero block, the card grid, the button radius, the rough font weight and the color palette. Then it writes HTML and CSS that approximate what it saw.

Notice the word approximate. It does not read exact pixel values from a flat image. A shade like #2F6FED may come back as #2E6EE8. Spacing arrives as a good guess, not a measurement.

Designer holding a phone with a layout screenshot toward a laptop

Screenshot, mockup, or photo

Not every image works equally well. Here is how the three common inputs behave:

Input typeAccuracyBest use
Clean screenshotHighRebuilding a page layout you already have
Design mockup exportHighTurning a comp into a first stylesheet
Photo of a screen or a sketchMedium to lowRough structure only
Hand drawn wireframeMediumGrid and section order, not styling

A flat screenshot at normal size gives the best result. A photo of a monitor adds glare, skew and moire patterns, and the model may read those as design choices.

Prompts That Produce Clean CSS

A bare "turn this into CSS" works, but it leaves too much open. The model will invent class names, pick a random unit system and ignore responsive behavior. Give it constraints.

The base prompt

Use this as your starting point and swap in your own details:

Build the layout in the attached image as semantic HTML and plain CSS.
Use CSS custom properties for colors and spacing.
Use CSS grid for the card section and flexbox for the header.
Mobile first, with breakpoints at 640px and 1024px.
Name classes with BEM. No frameworks, no inline styles.
After writing it, render the page, compare it to the image,
and list the differences you still see.

The last two lines matter most. Asking for a comparison pushes the agent to check its own work, and it will often catch an off-center button or a wrong gap before you do.

Hands typing on a laptop with a mockup beside code

A prompt for design tokens

Sometimes you do not want a page, only the values. Try this:

Look at the attached image. Extract a design token set as CSS variables:
primary, secondary and neutral colors, border radius scale,
shadow levels, spacing scale based on 4px, and font size scale.
Output only a :root block with comments for where each token is used.

You get a short, reusable file instead of a pile of one-off values. This is the cleanest way to bring a brand look into an existing codebase.

A prompt for responsive behavior

A single image shows one screen size. The model has to guess the rest. Tell it what should happen:

The image shows the desktop view at 1440px.
At 768px the three cards become two columns.
At 480px they stack and the header collapses to a menu button.
Keep the hero text centered at every size.

Without that, the cards may overflow on a phone, since nothing in the picture says otherwise.

💡 Tip: If you have both a desktop and a mobile image, attach both and label them. Say "image 1 is desktop, image 2 is mobile." Two references remove most of the guessing.

Real Examples You Can Copy

These three cases come up all the time. For each, the prompt and the thing to watch for.

Top-down view of a desk with a printed mockup, tablet and wireframe notebook

Example one: a pricing card

Attach a screenshot of a three-tier pricing section and send:

Recreate the pricing section from the image.
The middle card is highlighted: slightly larger, with a colored border.
Use grid with equal column widths and a 24px gap.
Buttons are pill shaped with a hover state that darkens by 8%.

Expect the structure to be right on the first pass. Expect to adjust the highlighted card's scale, because "slightly larger" is vague. Replace it with transform: scale(1.04) in your prompt if you want precision.

Example two: a hero section

Attach a hero banner with a headline, a sub line, two buttons and a photo on the right:

Build this hero as a two column layout.
Text left, image right, vertically centered.
The headline uses clamp() so it scales between 2rem and 3.5rem.
On screens under 768px put the image above the text.
Use object-fit: cover on the photo with a 16 by 9 ratio.

Here the model usually does well, since a hero is a simple pattern it has seen thousands of times. The common slip is the image crop, so check it on a narrow screen.

Two developers reviewing a monitor together in a bright workspace

Example three: fixing a layout bug

This one is where image input shines for existing projects. Take a screenshot of the broken page and send:

This screenshot shows a bug: the sidebar overlaps the main content
at about 900px wide. Find the CSS causing it in this repo,
fix it with the smallest change possible, and explain what was wrong.

Because Codex can open the files, it can match what it sees in the picture to a rule in your stylesheet. A typical cause is a missing min-width: 0 on a flex child, or a position and z-index clash. Ask for the smallest change so it does not rewrite files you did not want touched.

💡 Tip: After any fix, ask for a screenshot of the result at three widths. A fix that works at 900px can break at 700px.

Phone, tablet and laptop lined up showing the same landing page

Free Options Right Now

People ask whether this can be done for free. The honest answer has two parts.

Free ChatGPT account access

Codex can be reached with a free ChatGPT account, but the access is limited. OpenAI does not publish a clear number of tasks you get on the free tier, and the cloud version of Codex is not part of it. Usage limits also change often, so check the current pricing page from OpenAI before you plan a project around it.

One more point from my research: OpenAI's docs state that image generation is not available on the free plan. That is about creating pictures, not necessarily about attaching one to a coding prompt, and I could not confirm how image uploads are treated on the free tier today. The safest move is to try a single screenshot and see what happens.

Access routeCostPractical limit
Free ChatGPT accountFreeLimited, unpublished allowance
Paid ChatGPT plansMonthly feeHigher allowance, image use counts faster than text
API keyPay per useBilled by tokens, images included

On paid plans, a task with images uses your allowance faster than a text-only one, so a long session of screenshot prompts can run down the balance sooner than you expect.

Freelance developer working late at a desk with a warm lamp

Other free routes worth trying

Open source screenshot to code projects exist, but they usually call a paid model behind the scenes, so the software is free while the inference is not. If you want a no-install option, the next section covers models on PicassoIA that accept an image and can write CSS in the same way.

How to Get Similar Results on PicassoIA

Codex is an OpenAI product and is not on PicassoIA. For similar results today, the closest match is GPT 5.6 Sol, a coding focused model with image input. You get the image to CSS part of the workflow in a browser, with no setup. What you do not get is Codex's agent behavior, so it will not open your repo or run your build. You paste the output into your project yourself.

Steps with GPT 5.6 Sol

  1. Open the GPT 5.6 Sol page on PicassoIA.
  2. Upload your screenshot or mockup in the image input field.
  3. Paste the base prompt from earlier in the prompt box.
  4. Add a system prompt such as "You are a senior front end developer who writes clean, accessible CSS."
  5. Run it, copy the code into a local file, and open it in your browser.
  6. If something is off, reply with the specific difference, for example "the card gap is too tight, use 24px".

Settings worth changing

  • reasoning_effort: the default is none, which is fast. Raise it to medium or high for dense layouts with many nested sections.
  • verbosity: set to low if you only want the code, high if you also want notes on each rule.
  • max_completion_tokens: raise it when you use higher reasoning, since long thinking can use the whole budget and leave an empty reply.

Student in a library holding a printed web page next to a laptop

Other models that read images

Two more models on PicassoIA are worth a try for the same job:

  • Claude Sonnet 5 accepts an image and has an effort setting from low to max. It is a good choice when you want tidy, readable code with sensible class names.
  • Gemini 3.5 Flash takes up to 10 images per prompt, which helps when you have desktop, tablet and mobile views to send together.
  • GPT-4o is a lighter option for quick, simple layouts.

Running the same screenshot through two of these and comparing the CSS is a cheap way to find which one matches your coding style.

Common Mistakes to Avoid

Most disappointing results come from the same handful of causes.

Sending a low quality image

A blurry or tiny screenshot gives the model nothing to read. Use a sharp capture at its normal size, and crop out browser chrome and desktop clutter.

Asking for everything at once

A full landing page in one prompt produces long, tangled CSS. Build in pieces: header first, then hero, then cards, then footer. Each piece gets checked before you move on.

UI designer comparing a printed design comp with a browser window

Leaving the stack unspecified

If you do not name your tools, you may get Tailwind classes when you use plain CSS, or the other way round. Say it in the first line.

Trusting colors and fonts blindly

The model reads color from pixels, so it drifts. If you have the real hex codes and font names, put them in the prompt. A short list beats a guess every time.

Skipping the browser check

Always open the result at several widths. CSS that looks right at 1440px is often broken at 800px, and the model will not know unless you tell it.

Which Tool Fits Which Job

JobBest fitWhy
Fix a bug inside an existing repoCodexIt can open files and run the app
Turn a mockup into a first draftGPT 5.6 SolImage input, adjustable reasoning, runs in a browser
Clean, readable component codeClaude Sonnet 5Tidy output, effort control
Many screen sizes in one promptGemini 3.5 FlashAccepts up to 10 images
Quick small layoutGPT-4oFast and light

The rule of thumb is simple. If the job lives inside a project folder, use an agent like Codex. If the job is "make this picture into code," a browser model is faster and often cheaper.

Small business owner at a cafe table with a laptop showing a storefront page

Try It on Your Own Screenshot

Pick one real page you want to rebuild. Take a sharp screenshot, copy the base prompt from this article, and run it. Then run the same image through a second model and compare the two stylesheets side by side.

On PicassoIA you can do that in a few minutes: open GPT 5.6 Sol, upload your image, paste the prompt, and see what comes back. Then try Claude Sonnet 5 or Gemini 3.5 Flash with the same file. If your page also needs photos, hero banners or product shots, you can generate those on the platform too, and browse every model at picassoia.com/en/all-models.

Start with a single section, keep your prompts specific, and check the result in the browser. The first draft will be close. The second prompt, where you point out what is off, is where it gets right.

Share this article

Choose your language

FreeCreate AI Images and VideosFree, No Credit CardFree Generations to StartSeedance 2.5 Lite IncludedStart Free Now