Is web scraping legal?
Short answer
Web scraping is not illegal in itself, but it can break several laws depending on what is scraped, how and where. In the US, the CFAA, contracts, copyright and privacy law all apply. In the EU, GDPR covers personal data even when it is public, and database and copyright rules limit copying. This is general information, not legal advice.
The same script can be lawful when it reads train timetables and unlawful when it copies a competitor's database or collects people's profiles. Courts and regulators look at what data was taken, how it was accessed, what the scraper agreed to, and what was done with the result. This page explains the main laws in general terms for web scraping. It is not legal advice. The answer for a specific project depends on the jurisdiction and the facts, so ask a lawyer who practises there.
Is web scraping legal in the US?
The main federal statute is the Computer Fraud and Abuse Act (CFAA). It makes it an offence to access a computer "without authorization" or to "exceed authorized access", and site owners have used it against scrapers for years. Two decisions narrowed its reach.
In Van Buren v. United States (2021), the Supreme Court read "exceeds authorized access" narrowly. The question is whether a person enters parts of a system that are off limits to them, which the Court framed as whether a gate is up or down. Misusing data you were allowed to see is a different matter.
In hiQ Labs v. LinkedIn, hiQ scraped public LinkedIn profiles that anyone could view without logging in. The Ninth Circuit held that this likely did not access a computer "without authorization" under the CFAA. It said so in 2019 and again in its 2022 opinion, after the Supreme Court had sent the case back to be reconsidered in light of Van Buren. The reasoning concerned data open to the public. Pages behind a login were outside it.
The case did not end as a win for hiQ. The district court later found that hiQ had breached LinkedIn's User Agreement, and the case closed with a judgment against hiQ.
What other US laws apply to scraping?
- Contract law applies when the scraper accepted the site's terms. Terms accepted at signup are more likely to be enforced than terms linked in a footer that nobody clicks.
- Copyright does not protect plain facts such as prices or opening hours (the Supreme Court said so in Feist v. Rural, 1991). It does protect articles, photos, product descriptions and creative selections of data, so republishing scraped content can infringe even when the scraping itself was lawful.
- Trespass to chattels has been accepted where a scraper's load interfered with the site's servers. eBay v. Bidder's Edge (2000) is the early example.
- State privacy laws, such as California's, can apply when the scraped data is about identifiable people. Some treat publicly available information differently, so the details depend on the specific law.
Is web scraping legal in the EU?
EU law adds rules that apply even when the data is visible to everyone.
The General Data Protection Regulation (GDPR) covers any information about an identifiable person, published or not. A scraper that collects names, profiles, photos or contact details needs a lawful basis, often legitimate interests, which requires weighing the scraper's interest against the people's rights. It must also tell people their data is being processed and collect no more than it needs. Data protection authorities in several EU countries have fined Clearview AI for building a face database from scraped images.
The Database Directive gives a separate right to the maker of a database that took substantial investment to obtain, verify or present. Extracting or reusing a substantial part of it without permission infringes that right, and so can repeated, systematic extraction of small parts. Product catalogues, listings and directories often qualify.
Contracts matter too. In Ryanair v PR Aviation (2015), the Court of Justice held that when a database is protected by neither copyright nor the database right, its owner can still restrict use through contract terms.
The Copyright in the Digital Single Market Directive has two exceptions for text and data mining, meaning automated analysis of content:
- Article 3 lets research organisations and cultural heritage institutions mine content they can lawfully access, for scientific research.
- Article 4 lets anyone mine lawfully accessible content unless the rightholder has reserved that use "in an appropriate manner, such as machine-readable means" for content published online.
Which signals count as a valid reservation, for example robots.txt rules or a clause in the terms of service, is still being argued in courts and policy work. The AI Act requires providers of general-purpose AI models to have a policy for identifying and respecting these reservations. Most large AI crawlers document a robots.txt opt-out.
What decides whether a scraping project is lawful?
The answer usually turns on these questions:
- What the data is: facts, copyrighted works, a protected database, or personal data
- How it was reached: public pages, pages behind a login, or pages reached by getting around blocks the site put in place
- What the scraper agreed to, such as account terms or API terms
- How much was taken and how often, and whether the load affected the site
- What happens next: internal analysis, republishing, resale or AI training
- Where the scraper, the site and the people in the data are located
What can site owners do?
- Publish clear terms, and have users accept them at signup if you offer accounts.
- Publish machine-readable opt-outs, such as robots.txt rules for AI crawlers and, in the EU, a text and data mining reservation. Does robots.txt stop scraping? explains what those rules can and cannot do.
- Keep logs that show what was taken, when and from which networks. Evidence matters in a dispute.
- Use technical controls. Lawsuits are slow, and many scrapers are anonymous. How to prevent web scraping covers the layers.
Bot protection processes personal data as well, so the same GDPR questions apply to your own defences. Bot protection and GDPR covers that side.
Common questions
Is web scraping legal in the US?
No federal statute bans scraping as such. Whether a project is lawful turns on the CFAA, contract terms, copyright and state privacy laws, and courts have treated pages open to everyone differently from data behind a login.
Does GDPR apply to scraping public data?
Yes. Personal data stays personal data after it is published, so a scraper collecting names, photos or contact details from public pages needs a lawful basis and has to meet GDPR's transparency duties toward the people in the data.
Can a website's terms of service ban scraping?
Terms can restrict scraping and are strongest against someone who accepted them. They help in a dispute but do nothing against anonymous scrapers that never create an account, which is why sites pair them with technical controls.