ChatGPT, Claude, or Gemini gave me HTML code: how do I run it and see the page?
Quick answer
Copy the whole code block, from <!DOCTYPE html> to </html>, and paste it into an HTML viewer in your browser: the page runs with its CSS and JavaScript on a phone or computer, with nothing to install. ChatGPT, Claude, and Gemini Canvas also show it inside their own apps. To let others open it, publish it as a link.
Free plan: no credit card, 1 published page.
On this page
You asked ChatGPT for a quiz, a birthday card, or a small calculator, and the answer is a long block of code that starts with <!DOCTYPE html>. That code is a whole web page. In the chat it's text, unless the assistant shows a preview. This guide shows how to see it running on the phone or computer in front of you, what each assistant's own preview does, and where that preview stops.
Want a link instead? In the upload box at the top of this page, switch to Paste code, paste the code, and click Get my preview link. You get the link without an account. That preview runs no scripts, so a quiz or a game won't respond there yet. Click Keep this page — free, no card and sign up, and the page moves into your account, where its scripts run and you can publish it.
Got a downloaded .html file rather than code? See how to open an HTML file on iPhone or on a Mac. If Codex or Claude Code wrote the file on your computer, see how to preview an HTML file from Codex or Claude Code.
Check that you have a whole page
A page you can run is one block of code that starts with <!DOCTYPE html> or <html> and ends with </html>. Its CSS sits in a <style> tag and its JavaScript in <script> tags. On October 25, 2026, we pasted 4 kinds of answers into Convika's HTML viewer, in Chromium 156 and in Playwright's WebKit 27.2 test build at an iPhone 15's size. Both browsers gave the same results:
| What the answer looks like | What the viewer showed | What to do |
|---|---|---|
One block from <!DOCTYPE html> to </html> | The page ran: its script rewrote the heading, a counter counted clicks, and Tailwind from its CDN styled the text | Paste it as it is |
A fragment: a <div>, a <style>, and a <script>, with no <html> | It ran too: the script rewrote the text and the style colored it | Paste it, or ask for the whole page |
Code that starts with import React and has export default function | The code itself, as text | Ask for plain HTML and JavaScript with no build step |
| Words with no tags, like "Here is your page" | The message "This does not look like HTML. Check that you copied the page's whole code." | Copy the code block, not the words around it |
If the assistant split the page into separate HTML, CSS, and JavaScript blocks, or wrote a React component, ask it for one file. Paste this into the same chat:
Give me the whole page as one HTML file, from <!DOCTYPE html> to </html>, in one code block.
Put the CSS in a <style> tag and the JavaScript in <script> tags.
If it's a React component, rewrite it as plain HTML and JavaScript with no build step.
Use full https:// links for images.
Copy the code from ChatGPT, Claude, or Gemini
Assistants change their buttons often. The table gives what each one's help pages said on October 25, 2026. We didn't open the apps themselves, so it names only the controls the help pages name.
| Assistant | Where the HTML is | How the help says to get the code | Its own preview |
|---|---|---|---|
| ChatGPT | A code block in the answer | Copying the code is one of a code block's actions | Preview, on supported code blocks; HTML pages are one kind |
| Claude, a chat artifact made since September 16, 2026 | An artifact, beside the conversation | No copy or download control named. Ask Claude to put the page in one code block in its reply | The artifact |
| Claude, a legacy artifact made in a chat before September 16, 2026 | The artifact panel | "Use the controls at the top of the artifact panel to view the code, copy the content, or download it" | The artifact |
| Claude, a design made from the Design template | A design canvas | Export to standalone HTML | The canvas |
| Gemini, in Canvas | The Canvas panel | Code, at the top right of the panel, opens the code | The Canvas panel; Show console lists its errors |
| Gemini, in a regular answer | The answer | Share & export > Export to Replit, which takes HTML; no copy step named | None named |
- ChatGPT. OpenAI's help on code blocks says ChatGPT "usually places code in a code block." Depending on the block and your actions, you can "Copy the code" and "Switch between Code and Preview for supported previews." It adds: "Available actions vary by plan, device, workspace settings, model, and rollout."
- Claude. Anthropic's artifacts guide says, "An artifact opens in its own window beside your conversation." It names Export for artifacts made from a template and the panel controls for legacy ones, and no control for the rest. How to download a Claude artifact as an HTML file goes through each kind, with the request that gets the code into one block.
- Gemini. Google's Canvas help says: "To open and edit the code, at the top right of the Canvas panel, click Code." Under Share & export, Copy contents is "To copy the text." For a regular answer, Google's export help lists Export to Replit, which sends "your prompt and the Gemini app's response to Replit," and warns that "Exports to Free Replit accounts are publicly visible on Replit."
Whichever assistant made it, copy everything from the first <!DOCTYPE html> to the last </html>. A page cut off halfway shows up broken or blank.
Run the code in your browser in 4 steps
These steps work the same on a phone and a computer. Nothing is installed, and nothing is uploaded.
1. Copy the whole code block
Copy from the first <!DOCTYPE html> to the last </html>, as in the section above. If the answer has more than one block, ask for one file first.
2. Open the HTML viewer and choose Paste code
Go to Convika's free HTML viewer in your browser and choose Paste code. It needs no account. The code stays in your browser: it reaches Convika only if you press Get a link by uploading this page.
3. Paste it and click Show the page
Paste the code into the box and click Show the page. The page runs in a frame walled off from convika.com, with its CSS and JavaScript. It loads images, fonts, and scripts from other sites, such as Tailwind from a CDN. Pasted code can be up to 2 MB.
4. Press every button
Click through the page: the buttons, the tabs, the quiz to the end. Switch the width to Phone to see it at a phone's width. To change something, click Edit the code, edit it, and click Show the page again. If you're not sure what a page's code does, turn off Run scripts first: the page then shows its HTML and CSS only.
What runs in the viewer, and what doesn't
In the same October 25 test, with the whole page pasted:
- Ran: the page's own script, a click counter, and Tailwind from
cdn.tailwindcss.com. - No pop-up boxes: a button that called
alert()showed nothing, and the script carried on at once. The viewer's frame isn't allowed to open dialogs or new windows. - No new tabs: a link with
target="_blank"opened nothing. - No saved data: writing to
localStoragethrew aSecurityError, so a game that saves a high score can stop at that line. - No files beside the page: pasted code can't bring
style.css,game.js, orphoto.pngwith it. When the code points to files like these by name, the viewer lists them under the page. Why images and styling go missing covers the fix.
A page that needs pop-ups or saved data runs better from a file in your browser, as in the next section.
Save the code as an .html file instead
To keep the page, or to open it without the chat, save the code in a plain-text editor with a name ending in .html:
- On a Mac. Apple's TextEdit guide says to choose File > New, then Format > Make Plain Text. Paste the code, choose File > Save, enter a name like
quiz.html, and click Use .html when TextEdit asks. - On Windows. Paste the code into Notepad and save it with a name ending in
.html. Then check the name in File Explorer. If you don't see extensions, Microsoft's file name extensions help says to select View > Show > File name extensions. A name that ends in.html.txtbelongs to a text file: rename it to end in.html. Microsoft notes that a new extension "won't convert the file to another format", and here it doesn't need to: the text inside is already HTML.
Double-click the file, and it opens in your browser. A page with all its code inside the file runs there. One that loads a module script or a data file from its folder is blocked from disk, as our Mac test shows. On an iPhone, tapping the file in Files opens a preview that ran no JavaScript in our iOS 26.3 test, so use the viewer there. If the file opens as code or as a blank page, see why an HTML file shows code or a blank page.
Each assistant's own preview, and where it stops
| Assistant | Where its preview runs | Who can open it from a link |
|---|---|---|
| ChatGPT | Inside ChatGPT. OpenAI says "Code previews and code execution use a sandboxed environment" | A share link shows the conversation, or one response. Anyone with a link from a personal account can view it; a workspace link opens only for that workspace's members |
| Claude | The artifact's window beside the conversation | "Everyone needs a Claude account," Anthropic says. "The only exception is a legacy artifact published from a chat." Sharing with anyone who has the link is on Pro, Max, Team, and Enterprise, not Free |
| Gemini | The Canvas panel | "Shared links only open in gemini.google.com. You can't open shared Canvas content in the Gemini mobile app." |
Each preview is enough to check the page yourself. It stops when someone else must open the page as a page: a share link to a ChatGPT chat shows the chat, a Claude link asks for a Claude account, and a Gemini link needs a browser on gemini.google.com. OpenAI adds that "If a preview requires outside resources, ChatGPT may ask for permission before connecting."
The sources: OpenAI's sharing help, Anthropic's sharing guide, and Google's Canvas help, each read on October 25, 2026.
Send it as a link
A link opens on any phone or computer, without an AI account. With Convika:
- In the upload box at the top of this page, switch to Paste code, paste the code, and click Get my preview link. You get a link in seconds, without an account. It works for 3 minutes, with scripts and forms off. In the viewer, Get a link by uploading this page makes the same link.
- Click Keep this page — free, no card and sign up. The page moves into your account, and its scripts run in the dashboard preview.
- Publish it from the page's screen, then send the link instead of the code.
The publishing guide for your assistant covers the rest, with other hosts compared: ChatGPT, Claude, or Gemini Canvas. If you were looking for ChatGPT's canvas, where ChatGPT canvas went explains the change.
Frequently asked questions
How do I run HTML code from ChatGPT?
Copy the whole code block and paste it into an HTML viewer in your browser. In Convika's free HTML viewer, choose Paste code, paste, and click Show the page; the page runs with its scripts, and the code isn't uploaded. Inside ChatGPT, OpenAI's help says to select Preview on a supported code block, and that the actions you see vary by plan and device.
Can I open ChatGPT's HTML on my phone?
Yes. Copy the code in the ChatGPT app, open an HTML viewer in your phone's browser, choose Paste code, and tap Show the page. In our test at an iPhone 15's size, in Playwright's WebKit 27.2 test build, the pasted page's script and its Tailwind styles ran. We didn't test a physical phone. Saving the code as a file and tapping it in the iPhone's Files app gives a preview that ran no JavaScript in our iOS 26.3 test.
Why does ChatGPT's HTML show as text when I save it?
Usually the file isn't a plain-text file whose name ends in .html. On Windows, show file name extensions in File Explorer and rename page.html.txt to page.html. On a Mac, choose Format > Make Plain Text in TextEdit before you paste, and click Use .html when you save. In our test, a React component showed as text even in a browser, so ask for plain HTML and JavaScript.
How do I turn ChatGPT's code into a website?
Publish the code on a host, and send the link it gives you. On Convika, switch the upload box to Paste code and paste it for a preview link without an account, then keep the page on the Free plan and publish it. The link opens the page in any browser, with no ChatGPT or Convika account. How to publish ChatGPT HTML compares 6 hosts.
Does Claude have a button to run the code?
No separate button: Claude runs the page as an artifact, which "opens in its own window beside your conversation," Anthropic's help says. To run it anywhere else, you need the code. The help names Export for template artifacts and copy or download controls for legacy artifacts only. For any other artifact, ask Claude to put the whole page in one code block in its reply, then paste it into an HTML viewer.
Does Gemini have a button to run the code?
In Canvas, yes: the Canvas panel shows the app, Code at its top right shows the code, and Show console shows its errors. For a regular answer, Google's help names no preview. It names Share & export > Export to Replit, which supports HTML and sends your prompt and Gemini's answer to Replit. Google warns that exports to Free Replit accounts are publicly visible.
Why do some buttons do nothing in the HTML viewer?
The viewer runs the page in a walled-off frame. In our test, alert() showed no box, a link that opens a new tab opened nothing, and localStorage threw a SecurityError. A button that relies on any of these does nothing there. Save the code as an .html file and open it in your browser, or publish it. Files the page loads by name, like style.css, can't come with pasted code at all.
Is my code uploaded when I paste it into the viewer?
No. Your browser reads the code and shows the page, and nothing reaches Convika's servers. The page itself still loads what it links to, such as fonts, images, and scripts from other sites. The code goes to Convika only if you press Get a link by uploading this page, which uploads it for a private link that works for 3 minutes.
Sources
- Working with writing blocks and code blocks in ChatGPT (OpenAI) (checked October 25, 2026)
- Sharing conversations and scheduled tasks in ChatGPT (OpenAI) (checked October 25, 2026)
- What are artifacts and how do I use them? (Anthropic) (checked October 25, 2026)
- Share artifacts (Anthropic) (checked October 25, 2026)
- Create docs, apps & more with Canvas (Google) (checked October 25, 2026)
- Export responses from Gemini Apps (Google) (checked October 25, 2026)
- Work with HTML documents in TextEdit on Mac (Apple) (checked October 25, 2026)
- Common file name extensions in Windows (Microsoft) (checked October 25, 2026)
Next step
How to password protect an HTML page without code, on your own domain
JavaScript passwords sit in the page code. Put an HTML page from ChatGPT or Claude behind a server-checked password on your own domain.
Related articles
- How to publish an HTML page from ChatGPT as a live website, freeCompare Netlify Drop, GitHub Pages, Cloudflare Pages, Tiiny Host, ChatGPT Sites, and Convika on free limits, domains, and forms. Then publish yours.
- How to share a Claude artifact as a link, or deploy it to a real web addressClaude's share link needs a Claude account to open. Paste the artifact's code into Convika and publish it: a real web address anyone can open, free.
- How to host a website Gemini Canvas made, on your own domainA Gemini Share link opens only on gemini.google.com. Host your Canvas website at your own URL with working forms and visitor stats for free.
- How to download a Claude artifact as an HTML file, and share it as a linkWhat Claude lets you save from each kind of artifact, how to save the code as an .html file, and how to share it with people who have no Claude account.
- ChatGPT canvas is gone: where your HTML shows now, and how to share itOpenAI took canvas out of GPT-5.5 on May 28, 2026. HTML now shows in a code block Preview in ChatGPT. To let others open the page, publish it.
- How do I open an HTML file on an iPhone, and how do I send one that opens?Tap an .html file in the iPhone Files app and you get a preview with no scripts. Open it in Safari with a free viewer, or send a link instead of the file.