Skip to content

Nmap Command Builder: Build a Command and Learn What Each Flag Does

Nmap is a free, open source network scanner used for host discovery and security auditing. Choose options below and this page writes the command and explains every flag in plain English, using the Nmap Reference Guide. It does not scan anything: you copy the text and run it yourself, on systems you are authorised to test.

TL;DR

The short version

5 points
  • Nmap ("Network Mapper") is, in its own words, a free and open source utility for network discovery and security auditing.
  • A command has the shape nmap [scan type] [options] {target}. The builder below assembles it from checked options and explains each flag.
  • By default Nmap discovers which hosts are up, then scans the 1,000 most common ports of each; SYN scan (-sS) is the default with raw packet privileges, and connect scan (-sT) is used without them.
  • This page never scans anything and sends nothing. Only run the command against systems you own or have written permission to test. Nmap permits scanning scanme.nmap.org for testing, within its limits.
  • Evasion, spoofing, brute-force and exploit options are deliberately not offered here.

Authorised use only

Scanning systems you do not own or have written permission to test can breach laws, your internet provider's terms and your employer's policy. Nmap's own guide says to always secure written authorization from the target network's representatives. This page never scans anything. It only writes the command as text.

Target

Hostnames, IPs, CIDR (/24) and octet ranges work. Nmap's guide permits scanning scanme.nmap.org for testing, limited to about a dozen scans a day and to Nmap scanning only.

Scan type
Ports
Detection
Discovery, timing and output

Your command

nmap scanme.nmap.org

Tick the authorisation box above to enable Copy.

What each part does

  • nmap The program. Arguments that are not options are treated as targets.
  • With no options Nmap does host discovery, then scans the 1,000 most common ports of each host that responds.
  • scanme.nmap.org The target specification.

Reading the results: port states

  • open: a service is listening and accepts connections or replies.
  • closed: reachable, but nothing is listening.
  • filtered: Nmap cannot tell, because packet filtering is probably blocking its probes.
  • unfiltered: reachable by an ACK probe, but open or closed is unknown (ACK scans only).
  • open|filtered: no response, so Nmap cannot say which (UDP and some other scans).

To judge whether an open port is a problem, look it up in the Port Risk Lookup, check the exposure against your firewall rules, and scope any authorised test with the Penetration Test Scoping tool.

Target formats

Hostnames and IP addresses work, as does CIDR (192.168.10.0/24 covers 256 addresses), octet ranges (192.168.3-5,7.1), -iL file to read targets from a file and --exclude to leave hosts out. A hostname resolves to its first address only unless --resolve-all is used.

Nmap vulnerability scan: what it can and cannot do

Nmap's scripting engine groups scripts into categories. The vuln category, per the Nmap documentation, checks for specific known vulnerabilities and generally reports only when it finds one; nmap --script vuln example.com is the documented form. Two cautions from the same page: scripts are not run in a sandbox, and the intrusive category contains scripts likely to crash a target, which --script "not intrusive" excludes. Only run any of this against systems you own or have written permission to test.

Treat the result as a lead, not a verdict. For broad coverage use a dedicated scanner (see the free vulnerability scanner roundup and its OpenVAS section), then rank findings with the KEV checker. Scanning is the active half of reconnaissance.

Sources

Last reviewed 3 November 2026. Nmap is a third-party project; PlayCISO is not affiliated with it. This is general information for the US, not legal advice.

Frequently asked questions

What is Nmap used for?

Nmap is a free and open source utility for network discovery and security auditing. Defenders use it to inventory hosts, see which ports and services are exposed, and check that firewall rules do what they should. Port results are states: open, closed, filtered, unfiltered and open|filtered.

What does nmap -sS do?

It runs a TCP SYN scan, also called a half-open scan. Nmap sends a SYN and never completes the handshake. A SYN/ACK reply means the port is open, a RST means closed, and no response after retransmissions means filtered. It needs raw packet privileges and is the default scan type when you have them.

What is the difference between -sS and -sT?

-sS crafts raw packets and needs privileges. -sT asks the operating system to make a full TCP connection, so it works without special privileges, but the guide says it is slower and more likely to be logged by the target.

What ports does Nmap scan by default?

The 1,000 most common ports for each protocol scanned. Use -F for 100, --top-ports N for the N most common, -p to choose ports, or -p- for all 65,535.

What does nmap -A do?

-A enables OS detection (-O), version scanning (-sV), script scanning (-sC) and traceroute. It does not enable timing or verbosity options. The reference guide warns that default script scanning is intrusive, so do not use -A on networks you lack permission to test.

What do the -T0 to -T5 timing templates mean?

They are named paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4) and insane (5). Normal is the default. The guide recommends -T4 for decent broadband or Ethernet connections and calls -T5 too aggressive for his taste, because short timeouts and few retries can cost accuracy.

What does -Pn do?

It skips host discovery and treats every target as up, so port scans, version detection and OS detection run against all of them. On a /16 that means 65,536 addresses.

Is it legal to run nmap?

The guide says the legal ramifications are complex and controversial, that no US federal law explicitly criminalises port scanning, that unauthorised scanning can still breach an ISP's acceptable use policy and the law in some places, and that you should always get written authorization from the target network's representatives. In the US, accessing a computer without authorization is covered by 18 U.S.C. 1030. This is general information, not legal advice; ask a lawyer in your jurisdiction.

Can I practise scanning legally?

Nmap grants permission to scan scanme.nmap.org for testing, limited to Nmap scanning (not exploits or denial of service) and about a dozen scans a day. You can also scan machines in a lab you own, such as virtual machines on your own computer.

Why does this builder omit decoys, spoofing and fragmentation?

Those options exist to evade detection, and this page is for learning and for authorised audits, where evading your own monitoring defeats the point. The full list is in the Nmap Reference Guide if you have a legitimate need.

How do I do an nmap vulnerability scan?

Nmap is a port and service scanner first, but its scripting engine has a vuln category of scripts that, per the Nmap documentation, check for specific known vulnerabilities and generally report only when they find one. The documented form is nmap --script vuln followed by the target. Run it only against systems you own or have written permission to test, and expect it to be noisier and more intrusive than a plain port scan.

Is Nmap a replacement for a vulnerability scanner?

No. Nmap's vuln scripts cover a limited set of checks. A dedicated vulnerability scanner such as OpenVAS/Greenbone runs a much larger library of tests and produces a findings report. Use Nmap to map hosts and services, then a vulnerability scanner for coverage.

Are Nmap scripts safe to run?

Not automatically. The documentation says the safe category is designed not to crash services, but Nmap cannot guarantee it, and intrusive scripts are the ones likely to crash a target or look malicious to administrators. Scripts are not run in a sandbox. Choose categories deliberately and use --script "not intrusive" to exclude the intrusive ones.

The tools people use most on PlayCISO.

All tools