Blog / Guides
How to Extract Text From a Website: 5 Easy Methods
By URLtoText Team · · 5 min read
Sometimes you just need the words on a page: to quote an article, summarize it with ChatGPT or Claude, feed it into a script, or save it for later. Web pages make that harder than it should be. Menus, cookie banners, ads, and layout code all come along when you try to grab the text.
This guide covers five ways to extract text from a website, from the quickest manual option to fully automated extraction. Each one fits a different job.
| Method | Best for | Handles JavaScript sites | Effort |
|---|---|---|---|
| Copy and paste | One short page | Yes | Low |
| Reader mode | Reading or saving one article | Partly | Low |
| Online URL to text converter | A few pages, clean output | Yes | Low |
| Python script | Developers, simple static pages | No (without extra tools) | Medium |
| Text extraction API | Many pages, apps, and AI pipelines | Yes | Low once set up |
1. Copy and paste (with a clean paste)
The simplest option still works for a single page. Select the text, copy it, and paste it without formatting so you don't carry over fonts and links:
- Windows and Linux:
Ctrl+Shift+V - Mac:
Cmd+Shift+Option+V
Downsides: it's slow for long pages, it's easy to miss sections, and it picks up stray menu items and buttons. It also doesn't scale past a handful of pages.
2. Use your browser's reader mode
Most browsers have a reader view that strips a page down to its article text:
- Safari: click the reader icon in the address bar.
- Firefox: click the reader view icon, or press
F9. - Chrome: open the side panel and choose Reading mode.
From there you can copy the cleaned-up text. Reader mode is great for articles, but it often fails on product pages, documentation, forums, and anything that isn't laid out like a blog post.
3. Use a free online URL to text converter
If you want clean output without installing anything, paste the URL into a converter. With URLtoText:
- Paste the page URL into the box.
- Choose an output format: plain text, Markdown, or HTML.
- Click Convert, then Copy.
Markdown is usually the best choice if the text is going into ChatGPT, Claude, or another AI tool. It keeps headings, lists, and links, which helps the model understand the page's structure.
For harder pages, a converter can do things copy and paste can't:
- Render JavaScript for sites that load their content in the browser, like many modern web apps and single-page sites.
- Use a residential proxy for sites that block ordinary requests.
- Target one part of the page with a CSS selector, such as
articleor.post-content, so you skip the navigation and footer. - Run an AI prompt on the result, for example "summarize this in five bullet points."
YouTube links work too: paste one and you get the video's transcript as text.
4. Write a Python script
For developers, a few lines of Python will pull the text from a simple static page using requests and BeautifulSoup:
import requests
from bs4 import BeautifulSoup
html = requests.get("https://example.com", timeout=30).text
soup = BeautifulSoup(html, "html.parser")
# Drop elements that never contain useful text.
for tag in soup(["script", "style", "nav", "header", "footer"]):
tag.decompose()
text = soup.get_text(separator="\n", strip=True)
print(text)
This is free and fully under your control, but it has limits:
- JavaScript-rendered pages come back empty or incomplete, because
requestsonly downloads the initial HTML. You'd need a headless browser like Playwright to fix that. - Many sites block scripts with bot detection, rate limits, or CAPTCHAs.
- Every site's layout is different, so you end up maintaining cleanup rules for each one.
5. Use a text extraction API
When you need text from many pages, or inside an app, chatbot, or AI agent, an API handles the hard parts for you: rendering JavaScript, rotating proxies, and returning clean output.
Here's the same job with the URLtoText API:
import requests
response = requests.post(
"https://urltotext.com/api/v1/urltotext/",
headers={"Authorization": "Token YOUR_API_TOKEN"},
json={
"url": "https://example.com",
"output_format": "markdown",
"render_javascript": True,
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]["content"])
The response also includes the page title and Open Graph metadata, so you can store or cite the source. Pricing is pay as you go: a basic request costs a fraction of a cent, and you only pay extra for options like JavaScript rendering or proxies on the pages that need them.
Which method should you use?
- One page, right now: copy and paste, or reader mode.
- A few pages, or text for ChatGPT or Claude: an online converter with Markdown output.
- A developer project with simple, static pages: a Python script.
- Lots of pages, JavaScript-heavy sites, or an AI pipeline: an API.
Frequently asked questions
Is it legal to extract text from a website?
Extracting publicly available text for personal use, research, or analysis is generally fine, but it depends on the site's terms of service, copyright, and your jurisdiction. Republishing someone else's content is a different matter. When in doubt, check the site's terms and avoid collecting personal data.
Why does my extracted text come out empty?
The page probably loads its content with JavaScript after the initial page load. Basic scripts and many tools only see the empty starting HTML. Use a tool that renders JavaScript, such as URLtoText with Render JavaScript turned on.
What's the best format for AI tools?
Markdown. It keeps headings, lists, tables, and links while dropping the HTML clutter, which makes it easy for language models to follow and uses fewer tokens than raw HTML.