Overview
Masscan is built for one job — scanning very large networks very fast. Where Nmap carefully fingerprints each host, Masscan blasts SYN packets asynchronously and can cover the entire public IPv4 space in minutes from a fast connection. Authorized teams use it to inventory their own external footprint: every exposed port across every IP they own, refreshed regularly.
Speed has a price: Masscan fingerprints less per host than Nmap, so the standard workflow is Masscan to find what answers, then Nmap to examine the interesting hosts closely. Never point it at ranges you do not own — internet-wide scanning without authorization will get your address blocklisted and possibly your account suspended.
Key features
- Internet-scale speed: millions of packets per second
- Async stateless design with minimal memory use
- Banner grabbing for service identification
- Output compatible with Nmap XML tooling
- Configurable transmit rate to stay inside policy
- Free and open source (AGPL)
Install & first run
# Build from source (Ubuntu/Debian)
sudo apt install git gcc make libpcap-dev
git clone https://github.com/robertdavidgraham/masscan.git
cd masscan && make
## Scan your own /24 for web ports (set YOUR rate)
sudo ./bin/masscan 203.0.113.0/24 -p80,443 --rate=1000
## Banner grab on the hits
sudo ./bin/masscan 203.0.113.0/24 -p80,443 --rate=1000 --banners
Real-world example
Your company owns a /24 it has not audited in years. With written authorization, run Masscan across it for common ports at a modest rate. Every unexpected open port — a forgotten camera, a dev database, a printer admin page — goes into the remediation queue, and the full sweep takes minutes instead of the weekend Nmap would need.
Common questions
Masscan or Nmap?
Masscan finds what answers across huge ranges fast; Nmap examines each host deeply. Use Masscan for discovery, Nmap for detail.
Why does 65536 packets per second matter?
Masscan is asynchronous and stateless: it sends and forgets, which is why it can scan the whole IPv4 space quickly and why it needs raw socket privileges.
Is it legal to scan the internet?
Scanning hosts you do not own is not authorized testing. Restrict --exclude / -iL lists to your own ranges, and never point it at a third party.
How do I get one line per open port?
-oL out.txt gives a grep-friendly list, --rate controls speed, and --source-ip sets the interface address when you have several.
Related tools
Nmap
The standard network scanner: discover hosts, ports and services on networks you are authorized to test. Free, open source.
Related reading: Nmap vs Masscan: Network Port Scanner Comparison
Keep exploring: browse every assessment phase in the Pentest Hub.
Authorized testing only — only ever test systems you own or have explicit written permission to assess.
