How to make a game with ChatGPT
No terminal, no engine, no account beyond the one you already have. Five steps, one prompt to copy, and the one place everybody gets stuck.
Jump to a section
Ask ChatGPT for the whole game in one message. Save what it writes into a file called game.html, then open that file. Play it, name the single thing that feels wrong, and send that. Ten minutes gets you something playable.
A ChatGPT account, free or paid. A web browser. Ten minutes. You do not need a code editor, a game engine, or any programming.
Five steps to your first game#
Open a fresh chat so nothing earlier confuses it. If your plan lets you choose a model, take the strongest one it offers. There is a section below on which that is.
One message, nothing else. ChatGPT answers with a single long block of code. That block is the entire game.
Copy the block, paste it into a plain text editor, and save it under that exact name. This is the step people trip on, so it has its own section next.
Double click it. Play it properly and lose on purpose. Most faults only show themselves at the moment you die or start again.
One, never ten. The score does not reset when I press play again. ChatGPT sends back a corrected file, you play again, and you name the next one.
Write a complete browser game as ONE .html file I can double click.
Everything lives in that one file. No frameworks, no downloads, no images.
THE GAME: a cat runs across rooftops. Tap or press space to jump the gap
between two buildings. The gaps get wider as the score climbs.
LOSING: fall in a gap and the run ends. Show the score, the best ever
score, and a button to run again.
CONTROLS: the space bar, and a tap anywhere on a phone screen.
LOOK: draw everything with canvas shapes and flat colour. No pictures.
MEMORY: keep the best score in localStorage.
THREE RULES THAT MATTER:
1. Move everything by elapsed seconds from requestAnimationFrame,
capped at 0.05, so a fast screen does not run the game at double speed.
2. Include the CSS rule canvas { touch-action: none; } or a tap on a
phone scrolls the page instead of jumping.
3. Gather every number I might want to change into one CONFIG object
at the top of the script.
Give me the finished file in one code block, ready to copy.
Rewrite the two lines under THE GAME and LOSING for your own idea and leave everything else alone. Those last three rules are the difference between a game that works on a phone and one that only works on the laptop you wrote it on.
That is the whole method. Everything below is detail on the steps you have already read.
Saving the file is where people get stuck#
A browser cannot play code that is sitting in a chat window. It needs a file on your computer, and the name of that file has to end in .html. Nothing else about this step is hard.
- On Windows. Open Notepad, paste, then File and Save as. Change Save as type to All Files, then type the name yourself. Left on Text Documents you get game.html.txt, which opens as a wall of code.
- On a Mac. Open TextEdit, choose Format then Make Plain Text, paste, and save it as game.html. Answer Use .html when it asks about the ending.
- Either way. Double click the saved file. A game means you got it right. Code on a white page means the name is still wrong.
Paid ChatGPT plans also include Codex, which is the OpenAI agent that runs on your own machine. It writes and saves the file itself, so none of this applies to it. The chat window is enough to finish a game, so there is no need to install anything today.
Then fix one thing at a time#
First versions run. They almost never feel good. Every hour between those two states is the same short loop.
- Paste errors instead of describing them. Press F12 in the browser, open the Console tab, and copy the red text into the chat. That usually ends the problem in one reply.
- Screenshot anything you can see. Press Win + Shift + S, or Cmd + Ctrl + Shift + 4 on a Mac, then Ctrl + V into the message box. A screenshot pastes exactly like text.
- Ask for the complete file every time. Splicing a fragment into the middle of a working file by hand is how beginners lose a working game. Say: send the whole file again.
- Keep the version that worked. Before a big change, save a copy as game-02.html. A bad answer then costs you one file instead of an evening.
The faults that turn up in nearly every first build, each with a ready prompt to fix it, are collected in the prompt guide.
Which ChatGPT model should you pick?#
Build with the strongest model your plan offers, then drop to a cheaper one for small edits once the game works. The list in the picker changes as OpenAI ships models, so go by what each one is for rather than by the name.
| Model | What it is for | API price per million tokens |
|---|---|---|
| GPT-6 Astra | Building the game, and bugs that survive two tries. | $10 in, $50 out |
| GPT-6 Sol | Coding and agent work at a much lower price. | $2 in, $10 out |
| GPT-6 Luna | Quick edits, and what free accounts are given. | $0.10 in, $0.50 out |
OpenAI list prices for the API, read from the pricing docs on 23 September 2026. Inside a ChatGPT plan none of this is metered, so read the column as a comparison rather than as a bill.
What a finished game really takes#
Ten minutes buys you something playable. A game other people play to the end is a different job, and every creator on Agent Games reports what theirs took.
| Model | Games here | Average tokens | Average build time |
|---|---|---|---|
| GPT-6 Astra | 5 | 7.9 million | 4 hours |
| Claude Fable 5.1 | 9 | 10.4 million | 13 hours 52 minutes |
| Claude Opus 5 | 14 | 4.2 million | 8 hours 36 minutes |
Every published game here with a reported token count, on 23 September 2026. The five GPT-6 Astra games arrived between 14 and 18 September and have been played 469 times.
Nobody here has built the same game twice with two models, and the figures come from the creators themselves. The table records what people reached for and what it took them. It does not say which model is better.
💬Games on this site written by GPT models
Common questions#
Can ChatGPT actually make a game?
Yes. It writes a complete browser game as a single HTML file, which you save and open. A simple arcade game often works on the first try. Levels, saved progress and anything with other players take many rounds of fixes.
Can I make a game with ChatGPT for free?
Yes. A free account can write a single file game. Free plans get the cheaper model and a message limit, so a long fixing session may stop for a few hours. The method itself does not change.
Where do I put the code ChatGPT gives me?
Into a plain text file named game.html, saved anywhere, then opened in a browser. On Windows use Notepad with Save as type set to All Files. On a Mac use TextEdit switched to plain text first.
Which ChatGPT model is best for making games?
The strongest one your plan offers, which is GPT-6 Astra on paid plans today. GPT-6 Sol handles small changes for a fraction of the price, and GPT-6 Luna is what free accounts are given. All three can write a simple arcade game.
How long does it take to make a game with ChatGPT?
About ten minutes to something playable. The five GPT-6 Astra games published here averaged roughly four hours of build time and 7.9 million tokens each. Finishing is the long part, not starting.
Can I publish or sell a game ChatGPT wrote?
It stays yours. Publishing it here does not change that, and anyone can play it without an account. The one rule is that you cannot name it after a game somebody else owns.
Where to go next#
When the game is worth someone else's time, publish it. It gets a page of its own listing the model, the prompt and the tokens behind it, and people can play it without signing up for anything.
For ten more prompts you can send unchanged, and a repair prompt for every common fault, read the prompt guide. If you also have a Claude account, the Claude version of this guide covers the same ground with an agent that writes the file for you. The made with pages list every game here by the model that wrote it.
Built something? Put it on Agent Games.
Publishing takes a file and a minute. Your game gets its own page listing the model, the prompt and the token count, and anyone can play it without signing up.
Read next