TL;DR — The 4 hashcat commands you'll use most

hashcat -m 0 -a 0 hashes.txt rockyou.txt # Dictionary attack hashcat -m 0 -a 0 hashes.txt rockyou.txt -r best64.rule # With rules (much better) hashcat -m 0 -a 3 hashes.txt ?d?d?d?d?d?d?d?d # Brute-force 8 digits hashcat -m 0 -a 6 hashes.txt rockyou.txt ?d?d?d?d # Hybrid: word + 4 digits

Each is explained below with full examples. The -m flag changes by hash type (see the hash modes section).

What is Hashcat?

Hashcat is the world's fastest password recovery tool. It uses GPU compute (CUDA on NVIDIA, OpenCL on AMD) to test billions of password candidates per second against captured password hashes. On an RTX 4090, it cracks MD5 at 164 billion hashes per second — meaning the entire 14-million-entry rockyou.txt wordlist completes in under a millisecond.

Hashcat supports over 300 hash types — MD5, SHA-1, SHA-256, NTLM (Windows), bcrypt, scrypt, WPA2 handshakes, Kerberos tickets, KeePass databases, encrypted PDF/ZIP/Office files, and modern algorithms like Argon2. It's pre-installed on Kali Linux and is one of the essential Kali Linux tools in any pentester's arsenal.

⚠️ Legal disclaimer: Cracking hashes from systems you don't own or aren't authorized to test is illegal under the Computer Fraud and Abuse Act (CFAA), the UK Computer Misuse Act, and equivalent laws worldwide. Practice on your own hashes, CTF platforms like TryHackMe and HackTheBox, or authorized pentest engagements.

How Hashcat Works

Hashcat doesn't "reverse" hashes — that's mathematically impossible. Instead, it does the same thing the original hashing system does: takes a candidate password, hashes it, and compares the result to your target hash. If they match, you've found the password.

The speed comes from doing this billions of times per second in parallel on a GPU. The technique that finds passwords comes from choosing good candidates — that's where attack modes, rules, and masks come in.

Installing & Verifying Hashcat

Hashcat ships pre-installed on Kali Linux. Verify it's there and that your GPU is detected:

Terminal — Verify hashcat
# Check version (should be 6.2.x or 7.0+) $ hashcat --version v7.0.0 # List available compute devices (verify GPU is detected) $ hashcat -I CUDA API (CUDA 12.9) ==================== * Device #01: NVIDIA GeForce RTX 4090, 23687/24080 MB, 128MCU # Update if needed $ sudo apt update && sudo apt install hashcat

If apt update fails with a signing-key or repository error, see how to fix broken Kali updates. If the terminal itself is new to you, the beginner commands guide covers the basics every example below assumes.

⚠️ Running in a VM? Hashcat in a Kali VM almost never accesses the host's GPU properly — VirtualBox and VMware can't passthrough most GPU compute. You'll get a CPU-only fallback that's 100-185x slower than running on the host. For real cracking work, install hashcat directly on the host OS (it runs on Windows, macOS, and Linux natively), or use a physical Kali install. Or just install Kali on bare metal if you do this often.

Hashcat Basic Syntax

Every hashcat command follows this pattern:

Terminal — Syntax
$ hashcat -m [hash-mode] -a [attack-mode] [hash-file] [wordlist|mask] # Example: MD5 dictionary attack with rockyou.txt $ hashcat -m 0 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt

The two most important flags:

The 6 Attack Modes

Hashcat has six attack modes. You'll use modes 0, 3, and 6 most often:

ModeNameWhat It Does
-a 0Straight (Dictionary)Try each word in a wordlist
-a 1CombinatorCombine words from two wordlists (word1+word2)
-a 3Brute-force / MaskTry all combinations matching a pattern
-a 6Hybrid Wordlist + MaskAppend a mask to each wordlist entry
-a 7Hybrid Mask + WordlistPrepend a mask to each wordlist entry
-a 9AssociationTargeted attack using known info (username, etc.)

Common Hash Modes (the -m flag)

Hashcat supports over 300 hash types. Here are the ones you'll actually encounter:

ModeHash TypeWhere You'll See It
0MD5Old web apps, CTFs, legacy systems
100SHA-1Older systems, Git, some legacy auth
1400SHA-256Common modern hash
1000NTLMWindows password hashes (from SAM, mimikatz, etc.)
1800sha512cryptModern Linux /etc/shadow
500md5cryptOlder Linux /etc/shadow
3200bcryptModern web apps, password managers
22000WPA2 (PMKID+EAPOL)WiFi handshakes (modern unified mode)
13100Kerberos 5 TGS-REPActive Directory "Kerberoasting" attacks
18200Kerberos 5 AS-REP"AS-REP roasting" attacks
13400KeePass 1/2KeePass password database files
9400MS Office 2007Encrypted Office documents
17200PKZIPEncrypted ZIP files
34000Argon2Modern algorithm; very slow to crack

If you don't know what hash type you have, use a hash identifier tool:

Terminal — Identify hash type
# hash-identifier (interactive, pre-installed on Kali) $ hash-identifier # hashid (faster, also pre-installed) $ hashid '5f4dcc3b5aa765d61d8327deb882cf99' Analyzing '5f4dcc3b5aa765d61d8327deb882cf99' [+] MD5 [+] NTLM # Or check hashcat's full list with hash names $ hashcat --help | grep -i 'wpa\|ntlm\|md5'

Dictionary Attack (-a 0) — Start Here

The dictionary attack is the most common — and most successful — type. You give hashcat a list of candidate passwords and it tries each one. If the password is in the list, you crack it.

Cracking an MD5 hash with rockyou.txt

Terminal — First crack
# Save an MD5 hash to a file $ echo '5f4dcc3b5aa765d61d8327deb882cf99' > hash.txt # Decompress rockyou.txt if you haven't already $ sudo gunzip /usr/share/wordlists/rockyou.txt.gz # Run the crack $ hashcat -m 0 -a 0 hash.txt /usr/share/wordlists/rockyou.txt

You'll see hashcat initialize, then crack the hash. Output looks like:

Hashcat output
5f4dcc3b5aa765d61d8327deb882cf99:password Session..........: hashcat Status...........: Cracked Hash.Mode........: 0 (MD5) Hash.Target......: 5f4dcc3b5aa765d61d8327deb882cf99 Time.Started.....: Sun May 10 09:30:14 2026 (0 secs) Time.Estimated...: Sun May 10 09:30:14 2026 (0 secs) Recovered........: 1/1 (100.00%) Digests

The cracked password is shown right after the hash, separated by a colon: password.

Cracking multiple hashes at once

Put one hash per line in a file. Hashcat will crack them all in parallel — at no speed penalty.

Terminal — Multiple hashes
$ cat hashes.txt 5f4dcc3b5aa765d61d8327deb882cf99 e10adc3949ba59abbe56e057f20f883e 25d55ad283aa400af464c76d713c07ad $ hashcat -m 0 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt # View what was cracked at any time $ hashcat -m 0 hashes.txt --show 5f4dcc3b5aa765d61d8327deb882cf99:password e10adc3949ba59abbe56e057f20f883e:123456 25d55ad283aa400af464c76d713c07ad:12345678

Rule-Based Attacks (The Real Power)

This is where hashcat shines. Rules tell hashcat to automatically mutate each wordlist entry — appending years, capitalizing, substituting characters, reversing. A single wordlist entry like password becomes Password, password1, p@ssword, PASSWORD123, drowssap, and hundreds more.

Best64.rule generates 64 variations of each word. Applied to rockyou.txt's 14 million entries, that's nearly 1 billion candidates — without storing them on disk.

Terminal — Rule-based attacks
# Dictionary + best64.rule (the most common combo) $ hashcat -m 0 -a 0 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule # Dive.rule — more aggressive, covers more mutations $ hashcat -m 0 -a 0 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/dive.rule # Multiple rule files (combinatorial — generates rules × rules candidates) $ hashcat -m 0 -a 0 hashes.txt rockyou.txt \ -r /usr/share/hashcat/rules/best64.rule \ -r /usr/share/hashcat/rules/leetspeak.rule # Generate random rules (when you've exhausted the built-in ones) $ hashcat -m 0 -a 0 hashes.txt rockyou.txt --generate-rules=100
💡 Pro tip: Two rules cover about 80% of real-world password patterns: best64.rule and dive.rule. The community-maintained OneRuleToRuleThemAll.rule (search GitHub) is even more comprehensive. Skip writing custom rules until you've exhausted these — they're rarely necessary for general cracking.

Mask Attack (-a 3) — Brute-Force With Patterns

When you know something about the password's structure — like "it's 8 digits" or "it starts with a capital letter" — a mask attack is far more efficient than pure brute-force. You build a pattern from character placeholders:

PlaceholderCharsetExample
?lLowercase lettersabc...xyz
?uUppercase lettersABC...XYZ
?dDigits0-9
?sSpecial characters!"#$%&'()...
?aAll printable ASCII?l + ?u + ?d + ?s
?hHex lowercase0-9, a-f
?HHex uppercase0-9, A-F
Terminal — Mask attacks
# 8 digits (00000000 - 99999999) — common WiFi router defaults $ hashcat -m 0 -a 3 hash.txt ?d?d?d?d?d?d?d?d # 7 lowercase letters $ hashcat -m 0 -a 3 hash.txt ?l?l?l?l?l?l?l # Capital letter + 6 lowercase + 1 digit (common Windows pattern) $ hashcat -m 0 -a 3 hash.txt ?u?l?l?l?l?l?l?d # Known prefix "summer" + 4 digits $ hashcat -m 0 -a 3 hash.txt summer?d?d?d?d # Variable length using --increment (try 4-8 character lowercase passwords) $ hashcat -m 0 -a 3 --increment --increment-min=4 --increment-max=8 hash.txt ?l?l?l?l?l?l?l?l

Custom charsets

For patterns that don't fit the built-in charsets, define your own with -1 through -4:

Terminal — Custom charsets
# Last char is digit OR special (?d?s) — use custom charset 1 $ hashcat -m 0 -a 3 hash.txt -1 ?d?s ?u?l?l?l?l?l?l?1 # Hex-only passwords (common for API keys) $ hashcat -m 0 -a 3 hash.txt -1 ?h ?1?1?1?1?1?1?1?1
⚠️ Brute-force gets impractical fast. An 8-character mixed-case alphanumeric password has 218 trillion combinations. On the fastest GPU that's still days. A 10-character password? Over a year. Above 10 characters, brute-force is almost never the answer — use targeted wordlists and rules instead.

Hybrid Attacks (-a 6 and -a 7)

Hybrid attacks combine a wordlist with a mask. They're often the most effective real-world attack because people constantly append numbers or years to common words.

Terminal — Hybrid attacks
# Mode 6: wordlist + mask (append a mask to each word) # Tries: password0000, password0001, ..., password9999, summer0000, ... $ hashcat -m 0 -a 6 hashes.txt rockyou.txt ?d?d?d?d # Mode 7: mask + wordlist (prepend a mask) # Tries: 0000password, 0001password, ..., 9999password, 0000summer, ... $ hashcat -m 0 -a 7 hashes.txt ?d?d?d?d rockyou.txt # Common pattern: word + year $ hashcat -m 0 -a 6 hashes.txt rockyou.txt 202?d # Word + 2 digits + special char $ hashcat -m 0 -a 6 hashes.txt rockyou.txt ?d?d?s

Real-World Examples

Let's go through the most common scenarios you'll actually hit.

Cracking NTLM hashes (Windows passwords)

NTLM hashes come from mimikatz, secretsdump, the Windows SAM database, or NTLM relay attacks. They're fast to crack — RTX 4090 hits ~288 GH/s.

Terminal — NTLM cracking
# Single NTLM hash $ hashcat -m 1000 -a 0 'b4b9b02e6f09a9bd760f388b67351e2b' rockyou.txt # Multiple NTLM hashes from secretsdump output $ hashcat -m 1000 -a 0 ntlm_hashes.txt rockyou.txt -r best64.rule # With optimized kernels for max speed $ hashcat -m 1000 -a 0 -O -w 3 ntlm_hashes.txt rockyou.txt

Cracking Linux /etc/shadow

Modern Linux uses sha512crypt ($6$ prefix). It's intentionally slow to crack — by design.

Terminal — Linux shadow cracking
# Extract just the hash from /etc/shadow $ sudo grep username /etc/shadow > shadow.txt # Identify the prefix to choose the mode # $1$ = md5crypt (mode 500) # $5$ = sha256crypt (mode 7400) # $6$ = sha512crypt (mode 1800) # $y$ = yescrypt (mode 29900, newer distros) $ hashcat -m 1800 -a 0 shadow.txt rockyou.txt

Cracking WPA2 WiFi handshakes

Mode 22000 handles both 4-way handshakes and PMKID captures. Capturing one in the first place needs a wireless card that supports monitor mode — see my guide to the best WiFi adapters for Kali Linux. For the full capture-to-crack workflow, see my WPA2 cracking tutorial.

Terminal — WPA2 cracking
# Convert .cap file from airodump-ng to hashcat format first $ hcxpcapngtool -o capture.hc22000 capture-01.cap # Crack with rockyou.txt $ hashcat -m 22000 -a 0 capture.hc22000 /usr/share/wordlists/rockyou.txt # With rules (typically the most effective approach) $ hashcat -m 22000 -a 0 capture.hc22000 rockyou.txt -r best64.rule

Cracking encrypted files (ZIP, Office, KeePass)

For these, you extract the password hash from the file first using a helper script from John the Ripper:

Terminal — Encrypted file cracking
# Extract hash from a ZIP file $ zip2john secret.zip > zip.hash $ hashcat -m 17200 zip.hash rockyou.txt # Extract hash from MS Office document $ office2john document.docx > office.hash $ hashcat -m 9400 office.hash rockyou.txt # Extract hash from KeePass database $ keepass2john database.kdbx > keepass.hash $ hashcat -m 13400 keepass.hash rockyou.txt

GPU Benchmarks & Performance Tuning

Run hashcat -b for a full benchmark of your hardware across all hash types. Here are typical 2026 speeds on common GPUs:

GPUMD5 (-m 0)NTLM (-m 1000)WPA2 (-m 22000)bcrypt (-m 3200)
RTX 4090164 GH/s288 GH/s2,600 kH/s185 kH/s
RTX 4080112 GH/s198 GH/s1,800 kH/s128 kH/s
RTX 4060 Ti52 GH/s92 GH/s750 kH/s52 kH/s
RTX 309097 GH/s175 GH/s1,600 kH/s108 kH/s
RTX 306032 GH/s58 GH/s470 kH/s32 kH/s
Apple M3 Max~28 GH/s~52 GH/s~420 kH/s~30 kH/s
Intel i7-13700K (CPU only)~6 GH/s~10 GH/s14 kH/s~2 kH/s

Numbers are approximate — actual speed varies with hashcat version, drivers, system load, and exact silicon. Use hashcat -b to test your own hardware.

Performance flags

Terminal — Performance tuning
# -O enables optimized kernels (fewer features, much faster) $ hashcat -m 0 -O hashes.txt rockyou.txt # -w 3 = "high" workload (uses more GPU). -w 4 = "nightmare" (makes desktop unusable) $ hashcat -m 0 -O -w 3 hashes.txt rockyou.txt # Benchmark all hash modes (or specify one with -m) $ hashcat -b $ hashcat -b -m 22000 # Limit GPU temperature abort to a safer value $ hashcat -m 0 hashes.txt rockyou.txt --hwmon-temp-abort=85 # Use only specific GPUs if you have multiple $ hashcat -m 0 -d 1,2 hashes.txt rockyou.txt

Session Management

Cracking sessions often take hours or days. Hashcat lets you pause, resume, and run multiple sessions in parallel.

Terminal — Session management
# Start a named session $ hashcat --session=workjob1 -m 0 hashes.txt rockyou.txt # Press 'q' during a run to quit cleanly (saves state) # Press 's' to see current status anytime # Press 'b' to bypass current attack and move to next # Resume a paused session $ hashcat --session=workjob1 --restore # Show all cracked results from a session $ hashcat -m 0 hashes.txt --show # Show only uncracked hashes $ hashcat -m 0 hashes.txt --left # Output cracked passwords to a file $ hashcat -m 0 hashes.txt rockyou.txt -o cracked.txt

Attack Strategy: What To Try First

The order I work through attacks on a new set of hashes:

  1. Identify the hash type with hashid if unclear
  2. Pure dictionary with rockyou.txt (5 seconds on a fast GPU — try it first)
  3. Dictionary + best64.rule (catches the majority of weak passwords)
  4. Dictionary + dive.rule (more aggressive mutations)
  5. Targeted wordlist + rules (SecLists, leaked databases, company-specific terms)
  6. Hybrid attack with year/digit suffix (people love "password2024")
  7. Mask attack on known patterns (router defaults are often 8 digits)
  8. Pure brute-force (only for short passwords on fast hash types)
💡 The 80/20 rule: About 80% of crackable passwords fall in steps 2-4 above. If those don't work after exhausting rules, the password is either truly random (uncrackable in reasonable time) or follows a pattern only a targeted wordlist would catch. Don't waste days on brute-force when the answer is in a better wordlist.

Hashcat vs John the Ripper

The two big password crackers are hashcat and John the Ripper. They're often compared, but they're complementary tools — pros use both.

FeatureHashcatJohn the Ripper
GPU accelerationExcellent (built for it)Limited
Speed (with GPU)100-185x fasterSlower
Hash format auto-detectionNo (you specify -m)Yes (automatic)
File-extraction helpersExternal toolsBuilt-in (zip2john, etc.)
Number of hash types300+400+
Best forBig jobs, fast hashesFormat detection, encrypted files

Real workflow: use John for hash identification and to extract hashes from encrypted files (its *2john scripts are unmatched). Then run the actual cracking on hashcat for GPU speed.

Common Issues & Troubleshooting

"No devices found / no usable devices"

Hashcat can't find your GPU. Causes: outdated drivers, missing CUDA toolkit (NVIDIA), or running in a VM without GPU passthrough. Check with hashcat -I. On Linux, install nvidia-cuda-toolkit if missing. In a VM, you'll likely need to run on the host instead.

"Hashfile 'xxx' on line N: Token length exception"

The hash format doesn't match the mode you specified. Either the wrong -m, extra whitespace in the hash file, or hashes mixed with non-hash content. Run hashid 'your-hash' to verify the type, and make sure the file has one clean hash per line.

"Cracking takes forever"

The expected speed depends on hash type and hardware. hashcat -b -m [mode] tells you what your hardware achieves on that hash. If actual speed is much slower than the benchmark, you're running CPU fallback (not GPU). Check hashcat -I. If actual speed matches benchmark and it's still slow, the candidate space is just too large — switch attack modes or get better wordlists.

"GPU temperature triggered abort"

Your GPU got too hot. Improve case cooling, reduce workload from -w 3 to -w 2, or raise the abort threshold (--hwmon-temp-abort=85 — but don't go above 85°C on consumer cards).

"Hashcat found 0/N digests"

Hashcat ran successfully but didn't crack anything. The password isn't in your wordlist (try more wordlists, add rules, try a mask attack), or the hash format is wrong (try a different -m).

Frequently Asked Questions

How do I know which -m mode to use?

Use hashid 'your-hash-here' to identify the hash type. Then look up the mode number in hashcat --help or the hashcat example hashes page. Common ones: MD5 = 0, SHA-1 = 100, NTLM = 1000, sha512crypt = 1800, bcrypt = 3200, WPA2 = 22000.

Can I run hashcat on Windows or macOS instead of Kali?

Yes. Hashcat runs natively on Windows, macOS (including Apple Silicon), and Linux. The Windows version often performs better than running it in a Kali VM because GPU passthrough is finicky. Apple Silicon's Metal API gives M1-M4 chips solid performance — around 25-35 GH/s on MD5 depending on chip tier. Download from hashcat.net.

Is hashcat illegal?

Hashcat itself is 100% legal — it's just a password recovery tool, and it has legitimate uses (forensics, recovering your own forgotten passwords, authorized pentesting). What's illegal is using it on hashes you obtained without authorization. The CFAA (US), Computer Misuse Act (UK), and equivalent laws make unauthorized password cracking a serious crime.

How long would it take to crack my password?

Depends entirely on (1) the hash type and (2) the password complexity. A weak 8-char password on a fast hash like NTLM cracks in minutes. The same password on bcrypt takes hours. A 15-character random password with mixed character types is effectively uncrackable on any current hardware — longer than the age of the universe. Strong passwords + slow hashes = safe.

What's the difference between -a 0 and -a 3?

-a 0 (dictionary) tests each entry in a wordlist file. Fast and effective when passwords are common. -a 3 (brute-force/mask) generates every combination matching a pattern. Thorough but exponentially slower as length increases. Use -a 0 first; only fall back to -a 3 for short or pattern-restricted targets.

Do I really need a GPU for hashcat?

Not strictly — hashcat falls back to CPU mode without one. But CPU is roughly 100x slower for fast hashes (MD5, NTLM, SHA-256) and only marginally slower for very slow hashes (bcrypt, Argon2, scrypt). For any serious cracking work, get a GPU. Even a used RTX 3060 will dramatically outperform CPU-only cracking.

What's the best wordlist to use with hashcat?

Start with rockyou.txt — it's pre-installed and cracks a surprising amount. For bigger jobs, install SecLists (sudo apt install seclists) or download CrackStation's 15GB wordlist. For targeted attacks, build custom lists with CeWL (website-derived) or CUPP (profile-based). See my full wordlists guide.

Why does hashcat sometimes ignore my rules?

Two common causes: (1) the rule file has syntax errors — hashcat silently skips malformed lines and reports the count, (2) you're stacking too many rule files and hitting the maximum rule capacity. Run with --debug-mode=1 to see which rules are being applied. Stick to one rule file at a time until you understand the tool.