How to Convert URLs to Markdown for ChatGPT and Claude
Step-by-step guide to extracting web content as clean Markdown for ChatGPT and Claude. Save tokens, get better responses, and streamline your AI workflow.
The Problem with Copy-Pasting Web Pages into AI
You found the perfect article to feed into ChatGPT or Claude. You select all, copy, and paste it into the chat. But along with the content you actually wanted, you've also pasted the site's navigation menu, cookie consent banner, sidebar widgets, newsletter signup forms, related article links, footer disclaimers, and probably a few hidden elements you can't even see.
This creates two problems. First, you're wasting tokens on content that has nothing to do with your question. Every token spent on a navigation menu is a token that could have gone toward actual context or a longer response. Second, the noise confuses the model. When ChatGPT or Claude sees a wall of text that mixes article content with boilerplate, it has to figure out which parts matter. Sometimes it gets that wrong, and you get answers that reference the sidebar instead of the main content.
The fix is straightforward: convert the URL to clean Markdown before pasting it into your prompt.
Why Clean Markdown Beats Copy-Paste
Markdown is a lightweight text format that preserves structure — headings, lists, links, code blocks — without any of the visual presentation baggage that HTML carries. When you convert a web page to Markdown, you get just the content in a format that LLMs handle extremely well.
Token Efficiency
HTML is verbose. A simple heading like "Getting Started" in HTML looks like <h2 class="section-title font-bold text-2xl">Getting Started</h2>. In Markdown, it's just ## Getting Started. Across an entire page, this difference adds up fast. On average, Markdown uses about 67% fewer tokens than the equivalent HTML. That means you can fit roughly three times as much actual content into the same context window.
Structure Preservation
Unlike plain text copy-paste, Markdown keeps the document's hierarchy intact. Headings remain headings. Bullet lists stay as lists. Code blocks stay formatted as code. This structure helps ChatGPT and Claude understand which parts are titles, which are details, and how sections relate to each other.
Before and After
Here's what a typical copy-paste looks like versus clean Markdown:
# Raw copy-paste from browser:
Home Blog Docs Pricing Login
Getting Started with the API
Posted by Admin | March 10, 2026 | 5 min read
Share on Twitter Share on LinkedIn
To authenticate, pass your API key in the header...
Related Posts
How to Use Webhooks
Rate Limiting Explained
Footer | Privacy Policy | Terms of Service | Contact# Clean Markdown output:
## Getting Started with the API
To authenticate, pass your API key in the header...The Markdown version contains only the content that matters. No navigation, no social buttons, no footer. ChatGPT and Claude can focus entirely on answering your question about the API.
Step-by-Step: Convert Any URL with MDConvert
The fastest way to get clean Markdown from a URL is to use MDConvert's URL to Markdown tool. It takes about ten seconds:
- Go to mdconvert.app/url-to-md — Open the URL to Markdown converter in your browser.
- Paste the URL — Drop in the full URL of the page you want to convert. The tool fetches the page, runs it through Mozilla's Readability algorithm (the same engine behind Firefox Reader View) to isolate the main content, and converts the result to clean Markdown.
- Copy the Markdown — Review the output, then copy it into your ChatGPT or Claude prompt. You can also edit the Markdown in the built-in preview before copying.
That's it. No accounts, no installs, no API keys. The conversion happens entirely in your browser, so the page content never leaves your machine.
Wrapping Markdown in Prompts
Once you have the clean Markdown, how you present it to the model matters. Dumping raw text into a prompt without any framing makes it harder for the LLM to distinguish between your instructions and the reference material. Two common approaches work well:
Using Triple Backticks
Wrapping the content in triple backticks tells the model that everything inside is reference material, not instructions:
Summarize the key points from this article:
```
## Getting Started with the API
To authenticate, pass your API key in the X-API-Key header.
All requests must be made over HTTPS...
```
Focus on the authentication and rate limiting sections.Using XML Tags
Claude in particular responds well to XML-style tags for separating context from instructions:
<context>
## Getting Started with the API
To authenticate, pass your API key in the X-API-Key header.
All requests must be made over HTTPS...
</context>
Based on the documentation above, write a Python function
that authenticates with this API and fetches user data.Both approaches make it clear where the reference content starts and ends. This helps the model give more accurate, focused responses because it knows exactly what to reference and what to treat as your instructions.
Token Savings in Practice
Token counts directly affect cost when using the ChatGPT or Claude APIs, and they affect how much context you can fit into a single conversation even in the free chat interfaces. Here's what the difference looks like in practice:
- A typical blog post as raw HTML with all its markup, scripts, and styling might consume around 5,000 tokens. The same article as clean Markdown: roughly 1,500 tokens. That's a 70% reduction.
- A documentation page with code samples, navigation breadcrumbs, and a table of contents sidebar might hit 8,000 tokens as HTML. As Markdown: around 2,500 tokens.
- A news article with ads, related articles, and comment sections could easily reach 10,000+ tokens as a raw paste. The actual article content in Markdown: often under 2,000 tokens.
If you're using the OpenAI or Anthropic API, those saved tokens translate directly into lower costs. If you're using the chat interface, they mean you can include more reference material before hitting the context limit.
When URL-to-Markdown Works Best
URL-to-Markdown conversion produces the best results with content-heavy pages that serve their content as server-rendered HTML:
- Blog posts and articles — These are the ideal use case. They're typically well-structured HTML with a clear main content area.
- Technical documentation — Docs sites like MDN, ReadTheDocs, and most framework documentation convert cleanly because they follow semantic HTML patterns.
- News articles — Most news sites use standard article markup that reader-mode algorithms handle well.
- Wiki pages — Wikipedia and similar wiki-style pages have consistent structure that converts reliably.
Known Limitations
Some types of pages do not convert well:
- JavaScript-heavy single-page apps. If the page content loads entirely via JavaScript (React, Vue, or Angular SPAs without server-side rendering), the fetched HTML may be empty. The content simply is not in the initial HTML response.
- Paywalled or login-gated content. The converter cannot authenticate with a site on your behalf. For these pages, use your browser's developer tools to copy the rendered HTML, then paste it into the HTML to Markdown converter instead.
- Heavily interactive pages. Dashboards, web apps, and pages that rely on user interaction to reveal content (tabs, accordions, infinite scroll) will only capture what's visible in the initial render.
Other Source Formats
Web pages are not the only content you might want to feed into ChatGPT or Claude. MDConvert handles several other formats:
- PDF to Markdown — Research papers, reports, and ebooks can be converted to Markdown for AI analysis. The converter extracts text while preserving headings and list structure.
- DOCX to Markdown — Word documents, meeting notes, and proposals convert cleanly, keeping formatting like bold, italic, and numbered lists.
- HTML to Markdown — If you already have raw HTML (from view-source, an API response, or an email), the HTML to Markdown tool converts it directly without needing a live URL.
For a full overview of how Markdown fits into AI workflows, see the Markdown for AI guide, which covers best practices for preparing context across all these formats.
Conclusion
Converting URLs to Markdown before feeding them into ChatGPT or Claude is one of the simplest ways to get better responses. You remove the noise, save tokens, and give the model clean, structured content it can actually work with. The process takes seconds with the right tool, and the difference in output quality is noticeable immediately.
Try it now with the URL to Markdown converter. Paste any URL, copy the clean Markdown, and see how much better your next ChatGPT or Claude conversation goes.