Andrej Karpathy — co-founder of OpenAI, former head of AI at Tesla, and one of the most respected voices in AI — dropped a tip today that's already going viral. The tip is one line long:

Karpathy's Tip

"At the end of any prompt, add: Format your entire response as a complete HTML document. Then save the output as response.html and open it in your browser."

That's it. One sentence at the end of any prompt transforms the output from a wall of text into a designed, interactive document with proper headings, color-coded sections, tables, collapsible accordions, and even dark mode support. It works on ChatGPT, Claude, and Gemini. No coding knowledge required.

Why Does This Work So Well?

When you ask AI for text, the model gives you information. When you ask for HTML, the model designs the information. The AI doesn't just answer your question — it creates a layout, chooses visual hierarchy, organizes sections, and presents the content in a way that's immediately scannable.

The difference is dramatic. A text response about "the top 10 JavaScript frameworks" gives you a numbered list with paragraphs. An HTML response gives you a comparison table with color-coded ratings, collapsible details for each framework, and a responsive layout that works on any screen.

As Karpathy puts it: "Long, dense blocks of text — even nicely formatted Markdown — quickly become exhausting. Your brain has to do all the heavy lifting: parsing structure, holding context, and mentally formatting the information. HTML changes the game completely."

How Do You Actually Do It?

Three steps. Takes under a minute.

Step 1: Write your prompt as normal. Any topic, any AI model.

Step 2: Add this line at the end: "Format your entire response as a complete HTML document with modern styling, clean layout, proper headings, and a dark background with light text."

Step 3: Copy the HTML output, save it as a .html file (any text editor works), and open it in your browser.

That's it. You now have a beautifully designed document instead of a wall of text.

💡 Pro Tip

Add "include collapsible sections, tables where appropriate, and a table of contents at the top" to your HTML prompt for even better results. The AI will create interactive elements that you can click to expand and collapse.

---

📬 Getting value from this? We publish weekly on AI tips that actually change how you work. Get it in your inbox →

---

Which 5 Prompts Work Best as HTML?

Not every prompt benefits from HTML output. Quick questions don't need it. But these five categories are transformative:

Use Case Why HTML Is Better Example Prompt Ending
ComparisonsSide-by-side tables with color coding"...as HTML with a comparison table and pros/cons highlighted"
Cheat sheetsOrganized grid layout, printable"...as a printable HTML cheat sheet with sections and examples"
Research summariesCollapsible sections, key highlights bolded"...as HTML with collapsible sections and a summary table at the top"
Learning guidesProgressive disclosure, interactive"...as an interactive HTML guide with expandable explanations"
Decision matricesWeighted tables with visual scoring"...as HTML with a scored decision matrix and recommendation"

What Can't HTML Output Do?

It's not magic. A few limitations:

No real interactivity. The HTML is static — no database connections, no live data, no actual app functionality. It's a designed document, not a web app.

Inconsistent quality across models. Claude generally produces the cleanest HTML with better visual design. ChatGPT sometimes overcomplicates the CSS. Gemini's HTML is functional but less polished.

Overkill for short answers. If you're asking "what's the capital of France," requesting HTML output wastes tokens and your time. This technique is for responses that would normally be 500+ words of text.

Requires saving a file. You need to copy the output, save it as .html, and open it in a browser. It's a few extra seconds, but it's not as seamless as just reading in the chat window.

What's Karpathy's Bigger Point?

The HTML tip is practical, but Karpathy's underlying argument is more important: "We're still using 2022-era interfaces for 2026-level intelligence." We type text prompts and get text responses. But these models can generate interactive documents, visual explanations, 3D simulations, and dynamic interfaces. We're barely scratching the surface of how AI can present information.

Karpathy predicts the next evolution: AI responses that are interactive videos, 3D simulations, or dynamic visualizations generated on the fly. Instead of reading about something, you'll experience it. HTML is the first step in that direction — and it's available right now.

This connects directly to context engineering — the skill of controlling not just what the AI says, but how it presents information. The output format is part of the context. A prompt that specifies "format as HTML with collapsible sections" produces fundamentally different (and better) results than the same prompt without format instructions.

For more practical prompting tips, try the free Prompt Optimizer — it restructures any prompt for better output, including format specifications. And for the full framework behind effective prompting, see our ICCSSE guide.

---

📬 Want more like this? Practical AI tips from the people who build AI, weekly. Subscribe free →

---

Frequently Asked Questions

Does this work on ChatGPT, Claude, and Gemini?

Yes. All major AI models can generate HTML. Claude generally produces the cleanest visual design. ChatGPT and Gemini both work well. Try it on whichever model you normally use.

Do I need to know HTML or coding?

No. You don't edit the HTML at all. You copy the AI's output, save it as a .html file using any text editor (even Notepad), and open it in your browser. The AI handles all the code.

Can I share the HTML output with colleagues?

Yes. The .html file is self-contained — just send the file and anyone can open it in their browser. No server or hosting needed. It works offline too.

What's the best prompt for getting great HTML output?

Add this to the end of any prompt: "Format your entire response as a complete, self-contained HTML document with modern styling, clean typography, a dark color scheme, proper headings, tables where appropriate, and collapsible sections for detailed explanations." The more specific you are about the design, the better the result.

Disclosure: Some links in this article are affiliate links. We only recommend tools we've personally tested and use regularly. See our full disclosure policy.