Port scanning is not illegal by itself under US federal law: no federal statute explicitly criminalises the act of probing a port to see if it responds. It becomes a legal problem when you scan systems without permission, especially as a step towards unauthorised access, causing damage, or breaking a contract or acceptable-use policy. Scanning your own systems, or systems you have written permission to test, is standard security practice and legal.
Key takeaways
- No US federal law explicitly makes port scanning a crime on its own, but that is not a free pass to scan anything.
- Authorisation is the deciding factor: your own systems and written permission are safe, other people's systems without permission are not.
- Even a lawful scan can breach an ISP policy, a cloud provider's terms, or your employer's rules — and can be treated as a step towards hacking.
Port scanning sits in a strange legal grey area. It is one of the first things every network security student learns, and also one of the first things an attacker does before breaking in. So is it illegal? The honest answer is: it depends on whose system you scan, and whether they said yes.
Is port scanning illegal?
No, not by itself under US federal law. No federal statute explicitly criminalises the act of sending a probe to a port to see whether it responds, and the Nmap Project's legal guidance says exactly that.
But "not a crime by itself" is not the same as "always fine". A scan without permission can still be part of an illegal intrusion, can breach a contract or an acceptable-use policy, and can get you sued, fired, expelled or banned by your ISP. The Nmap guide warns that improper use of Nmap can, in rare cases, get you sued, fired, expelled, jailed or banned by your ISP.
This article is general information about the law, not legal advice. If you are doing professional security testing, get a lawyer to review your contracts and your scope before you scan anything that is not yours.
What is port scanning, exactly?
Port scanning is the technique of probing a computer's network ports to learn which ones are open, closed or filtered, and what services are listening on them. A port is a numbered doorway for network traffic: port 443 is normally HTTPS, port 80 is HTTP, port 22 is SSH.
A scan does not, by itself, log you in or read anyone's data. It asks a question and listens for an answer. The most common tool is Nmap, a free, open-source scanner used by administrators, auditors and attackers alike. A SYN scan sends a connection request and reads the reply without completing the connection; a connect scan completes the full handshake.
That is why the same tool is both ordinary and suspicious. An administrator scans their own servers to check that only the right ports are open. An attacker scans a target to find the one open door worth trying next. The packets look similar. The difference is permission and intent.
If you want to see what your own connection looks like from the outside, our what is my IP tool shows your public address. It is a safe way to learn without pointing a scanner at anyone else.
The DNS lookup tool shows how a domain resolves, which is another safe way to explore how the internet maps names to addresses.
What does US law actually say about port scanning?
The main US federal law is the Computer Fraud and Abuse Act, or CFAA, at 18 U.S.C. § 1030. It criminalises accessing a computer without authorisation, or exceeding authorised access, and obtaining information or causing damage in the process. It does not mention port scanning by name.
That gap is the whole debate. A basic scan that only learns whether a port is open may not count as "access" at all, and may obtain no protected information and cause no damage. A scan that is followed by breaking in, stealing data or disrupting a service is clearly part of an offence under the CFAA, and the scan is evidence of the intent behind it.
The Supreme Court narrowed the CFAA in 2021 in Van Buren v. United States. It held that "exceeding authorized access" means entering areas you are not allowed to access at all, not merely breaking a use policy while you are allowed in.
That ruling makes it harder to argue that a scan alone, or a mere policy violation, is a CFAA crime — but it does not create a right to scan other people's systems.
The Department of Justice added charging guidance in 2022. Federal prosecutors should generally reserve "without authorization" cases for people who had no permission at all and knew it, and should not charge good-faith security research. That is a policy for federal prosecutors, not a law, and it does not bind state prosecutors, private plaintiffs, employers, schools, ISPs or foreign authorities.
When does port scanning become illegal?
A scan crosses the line when it stops being a neutral probe and becomes part of something the law already forbids. Four factors decide how a scan is judged.
| Factor | Safe | Risky or illegal |
|---|---|---|
| Authorisation | Your system, or written permission | Someone else's system, no permission |
| Intent | Finding your own open ports | Finding a way in to steal or damage |
| What follows | Nothing, or a fix you apply | Login attempts, exploitation, data theft |
| Effect on target | Negligible traffic | Disruption, downtime, or damage |
| Rules broken | None | ISP policy, cloud terms, employer rules |
An aggressive scan can also be a problem on its own. Flooding a small server with probes, scanning every port on thousands of hosts, or continuing after being told to stop can look like a denial-of-service attempt, and can cause real disruption. The CFAA's damage provisions cover knowingly causing damage to a protected computer, and "damage" in law can include downtime and the cost of responding.
State law adds another layer. Nearly every US state has its own computer crime statute, and some are written more broadly than the federal law. A scan that federal prosecutors would ignore could still be charged under a state law, or pursued as a civil claim by the system owner.
There is a documented cautionary case. In 1999, consultant Scott Moulton scanned networks connected to a Georgia emergency 911 system while doing contract work. A rival firm reported the scan, and Moulton lost his contract and was arrested on a CFAA charge.
The case became a landmark warning in the Nmap legal guide: even a scan done with good intentions, in a grey area of permission, can end in arrest and a lost livelihood.
Is port scanning illegal in other countries?
Most countries follow the same principle — unauthorised access is a crime — but the details and the enforcement differ. Do not assume US rules travel with you.
- United Kingdom: the Computer Misuse Act 1990 criminalises unauthorised access to computer material. Scanning without permission carries legal risk, and the UK has prosecuted unauthorised access cases aggressively.
- European Union: Directive 2013/40/EU requires member states to criminalise illegal access to information systems. Germany's §202a–c of the criminal code covers unauthorised access to protected data and systems.
- Other countries: many have their own computer misuse laws, and some treat unauthorised scanning as an offence in itself. If the target is in another country, that country's law may apply as well as your own.
The practical rule is the same everywhere: permission is what makes scanning safe. If you are testing for a client in another country, get written permission that names the systems, the methods and the time window, and have a local lawyer check it if the engagement is large.
What happens if a scan is not a crime but still breaks the rules?
Criminal law is only one risk. Most people who get in trouble for scanning never see a courtroom: they lose a job, an account or a contract instead.
- ISP complaints. A target that notices your scan can complain to your ISP. The ISP can warn you or terminate your service, and many ISP acceptable-use policies ban unauthorised scanning outright.
- Cloud and hosting terms. Cloud providers and hosting companies usually ban scanning from their platforms except in approved circumstances. Violating that can get your account suspended.
- Employer and school rules. Scanning your employer's or school's network without permission can be a disciplinary offence, even if the network is one you use every day.
- Bug bounty scope. Scanning a target that is in a bug bounty program is only safe inside the program's stated scope. Scanning outside it can get you banned from the program and reported.
- Civil claims. A system owner can sue for the cost of investigating and responding to a scan, even when no crime is charged.
These risks are why the Nmap guide's central advice is so simple: always secure written authorisation from the target network's representatives before you start scanning. A short email that says yes is worth more than any argument about whether the scan was technically legal.
How do you scan legally and safely?
Follow this checklist every time, and you will stay on the right side of the law and of every policy that matters.
- Get written permission. For a client, put the permission in a signed statement of work: who may test what, when, how, and under which limits. For your own systems, keep a note of what you own.
- Stay in scope. Scan only the systems named in the permission. A neighbouring server, a shared cloud host or a supplier's system is out of scope unless it is named.
- Learn on your own lab. Your home network, a virtual machine, or a deliberately provided training environment are the right places to practise.
- Keep it light. Scan the ports you need, at a reasonable rate, during an agreed window. Avoid aggressive timing that could look like an attack.
- Stop if asked. If a target, an ISP or a provider tells you to stop, stop immediately and keep the message.
- Keep records. Save the permission, the scope, the dates and the results. If anyone questions the scan later, those records are your defence.
For a business, the same discipline belongs in a policy. Only named staff should run scans, only against named systems, with written approval each time. Our small business cybersecurity checklist covers that alongside the other controls a small team should have in place.
If you run your own Wi-Fi, our guide to how to secure your Wi-Fi shows how to check your own network safely.
How do you detect port scans against your own network?
If scanning is a normal part of security work, it is also a normal thing to watch for on your own systems. A scan against you is often the first sign that someone is casing your network.
- Watch your firewall logs for repeated connection attempts to many ports from one address in a short time.
- Alert on unusual port probes, especially to ports that should never be open, such as database or remote-desktop ports.
- Close ports you do not need. A scan only finds a door if it is open, so the best defence is to have as few open as possible.
- Use an intrusion detection system on hosts and networks to flag scanning patterns automatically.
- Report abuse to the scanner's ISP if a scan is aggressive or persistent, and block the source address at your firewall.
Do not retaliate by scanning the scanner back. That puts you in the same grey area you are complaining about, and it tells the other side that you noticed, which is information they can use.
The bottom line
Port scanning is not a crime by itself under US federal law, but that fact protects you far less than most people think. What protects you is permission: your own systems, or a written agreement that names the target, the methods and the time window.
If you do not have that, do not scan. Practise on your own network, use a training host, and keep your records. You can check your own public footprint safely with the free what is my IP tool — and leave other people's systems alone until they invite you in.
Frequently asked questions
Is port scanning illegal in the US?
Not by itself. No US federal law explicitly criminalises port scanning as a standalone act. It can still be unlawful if it is part of unauthorised access, causes damage, or breaks state law, a contract or an acceptable-use policy.
Is it illegal to scan a website or IP address I do not own?
It is risky and often treated as unauthorised. Without the owner's permission, a scan can be seen as a first step towards hacking, can breach the target's terms of service, and can draw an abuse complaint to your ISP. Get written permission first.
Is using Nmap illegal?
No. Nmap is a legitimate, widely used security tool, and owning or running it is not a crime. What matters is what you point it at and whether you have permission, not the tool itself.
Can I scan my own home network?
Yes. Scanning systems and networks you own is legal and is one of the best ways to learn network security and to find open ports on your own devices. Check your ISP's acceptable-use policy if you scan beyond your own network.
What is the CFAA and how does it relate to port scanning?
The Computer Fraud and Abuse Act, 18 U.S.C. section 1030, criminalises accessing a computer without authorisation or exceeding authorised access. It does not mention port scanning by name, but a scan used to gain unauthorised access or cause damage can fall under it.
Can port scanning get me banned by my ISP?
Yes. Many ISPs ban unauthorised port scanning in their acceptable-use policies, and a target network that notices your scan can complain to your ISP. That can lead to a warning or losing your service, even without any criminal charge.
Is port scanning illegal in the UK or EU?
The UK Computer Misuse Act 1990 criminalises unauthorised access to computer material, and EU member states have similar laws under Directive 2013/40/EU. Scanning without permission carries legal risk there too, so the same rule applies: get permission first.
Does good-faith security research protect me?
Only partly. The US Department of Justice said in 2022 that qualifying good-faith security research should not be charged under its CFAA policy, but that is charging guidance for federal prosecutors, not a legal immunity. It does not bind state prosecutors, private plaintiffs or ISPs.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the Nmap Project's legal guidance, the text of 18 U.S.C. § 1030 and the US Department of Justice CFAA charging policy. This is general information, not legal advice.
How we write and fact-check →