Forgot your home Wi-Fi password, and the sticker on your router has worn off? Or need to connect a new device but can't be bothered to go through the router settings? Luckily, Windows stores all saved wireless network passwords—and they can be easily retrieved using command line (CMD) without third-party programs. This method works even if you don't have administrator rights (in 80% of cases), doesn't require installing any additional software, and takes less than a minute.
In this article you will find three working methods — from the simplest (a single command) to advanced (viewing all networks with passwords). We'll also discuss why CMD sometimes displays a blank field instead of a password, how to work around this problem, and what to do if the network you need isn't listed. Important: This method only works for networks to which the computer has previously connected—it is impossible to find out someone else's Wi-Fi password this way.
We warn you in advance: if you are using a corporate network with WPA2-Enterprise or 802.1X, these instructions won't work—such networks require certificates or domain logins and passwords. But for home routers (TP-Link, ASUS, Keenetic, MikroTik etc.) the approach is universal.
1. Quick way: one command for the current network
If you need to know the password from current Wi-Fi network, to which the computer is connected, one line in CMD is enough. This method is the fastest and works on Windows 7/8/10/11 without additional manipulations.
Open command prompt:
- 🔍 Click
Win + R, entercmdand pressEnter. - 🖱️ Or search for "Command Prompt" in the Start menu (right-click and select "Run as administrator" - this will help avoid access errors).
Enter the command:
netsh wlan show profile name="NETWORK_NAME" key=clear | find "Key Contents"
Replace NETWORK_NAME the name of your Wi-Fi network (case-sensitive!). For example, if the network is called "MyWiFi_5G", the command will be:
netsh wlan show profile name="MyWiFi_5G" key=clear | find "Key Contents"
The network name is specified exactly (with spaces and case sensitivity)|The command prompt is run as administrator (if the password is not displayed)|The computer is connected to the desired network (or was connected previously)-->
After executing the command, you will see a line like this:
Key content: your_password_here
If the password is empty or written (absent), go to the second method — the problem is with access rights.
2. Universal method: view all saved passwords
If the first command didn't work or you need to see passwords from all networksTo find Wi-Fi profiles your computer has ever connected to, use this method. It displays a complete list of Wi-Fi profiles with passwords (if saved).
Open CMD as administrator (required!) and enter:
netsh wlan show profiles
You will see a list of all saved networks. Copy the name of the one you need (for example, "DIRECT-xx-HP OfficeJet" for printer or "Xiaomi_miwifi" for router from Xiaomi). Then run:
netsh wlan show profile name="NETWORK_NAME" key=clear
Find the block in the results Security parameters - there will be a line Key content with a password. Example output:
Security settings:
Authentication type: WPA2-Personal
Encryption type: CCMP
Key content: 12345678qwerty
Why might the password not be displayed?
If the password is empty, it means:
1. The network is saved, but the password was not entered manually (for example, connecting via WPS).
2. The network profile is damaged (try deleting the network in "Settings" → "Network & Internet" and reconnecting).
3. Your account does not have permission to view (you need to run CMD as administrator).
To export all passwords at once into a text file, run:
for /f "tokens=4 delims=: " %a in ('netsh wlan show profiles ^| find "All user"') do @echo %a & netsh wlan show profile name="%a" key=clear | findstr "SSID name Contents" >> WiFi_passwords.txt
File WiFi_passwords.txt will appear in the folder C:\Windows\System32 (or wherever you launched CMD from).
⚠️ Attention: Do not share the password file via email or instant messaging—it contains access data for all your networks, including corporate ones (if they are saved).
3. Alternative method: via PowerShell
If CMD is blocked by antivirus or does not show passwords, try PowerShell — a more modern Windows tool. It's more likely to bypass security policy restrictions (for example, on office PCs).
Open PowerShell as administrator:
- 🔍 Click
Win + Xand select "Windows PowerShell (Administrator)". - 🖱️ Or enter
powershellin the search, right-click and select "Run as administrator".
Enter the command to view the password of the current network:
(netsh wlan show profile name="$(netsh wlan show interfaces | Select-String 'SSID' | ForEach-Object { $_ -replace '.*: ','' } | ForEach-Object { $_.Trim() })" key=clear) -Match 'Key Content'
For viewing all networks use:
netsh wlan show profiles | Select-String "All user" | %{$name=$_.Line.Split(":")[1].Trim(); netsh wlan show profile name="$name" key=clear} | Select-String "Key Content"
The results will be similar to CMD, but with cleaner formatting. PowerShell also allows you to export data to CSV for easy viewing:
$output = @(); netsh wlan show profiles | Select-String "All custom" | %{$name=$_.Line.Split(":")[1].Trim(); $output += [PSCustomObject]@{SSID=$name; Password=(netsh wlan show profile name="$name" key=clear | Select-String "Key Content" | %{$_.Line.Split(":")[1].Trim()})}}; $output | Export-Csv -Path "WiFi_Passwords.csv" -NoTypeInformation -Encoding UTF8
⚠️ Attention: In some Windows builds (for example, Windows 10 LTSC (or enterprise versions) access to passwords via PowerShell may be blocked by Group Policy. In this case, resetting the router password will help.
4. What to do if the password is not displayed
Sometimes instead of a password, CMD or PowerShell shows a blank line or an error "Failed to execute command". Here 5 reasons and solutions:
| Problem | Cause | Solution |
|---|---|---|
| Empty "Key Content" field | The password is not saved in the system (connection via WPS or guest access) | Reconnect to the network by entering the password manually |
| Access Denied Error | Insufficient rights (even if CMD is run as administrator) | Try it PowerShell or boot into safe mode |
The network is not listed netsh wlan show profiles |
The network profile has been deleted or corrupted. | Please reconnect to the network or restore your profile via netsh wlan add profile filename="path_to_file.xml" |
The password is displayed as dots (••••••••) |
A feature of some Windows builds (for example, Windows 10 Pro for Workstations) | Use PowerShell or third-party utilities like WirelessKeyView |
Team netsh not recognized |
Corrupted system files or a limited version of Windows (eg. Windows PE) | Restore the system via sfc /scannow or use a Windows LiveCD |
If none of the methods worked, there are two options left:
- 🔧 Reset the password on the router (click the button
Resetfor 10 seconds). - 📡 Connect to the router via cable and view the password in the web interface (usually
192.168.0.1or192.168.1.1).
5. View passwords in safe mode (if blocked by antivirus)
Some antiviruses (Kaspersky, ESET, Bitdefender) or corporate policies block access to Wi-Fi passwords via CMD. In this case, safe mode - it loads Windows with a minimal set of drivers and without third-party services.
How to enter Safe Mode:
- 🔄 Restart your computer while holding
Shift, then select Troubleshoot → Advanced options → Startup Settings → Restart. - 💻 After reboot, click
F4(or4on the numeric keypad) to select "Safe Mode".
In safe mode:
- Open CMD (no administrator required).
- Run the command
netsh wlan show profile name="NETWORK_NAME" key=clear. - The password will be displayed even if access was denied in normal mode.
After receiving the password, restart your computer in normal mode.
⚠️ Attention: Wi-Fi may not work in Safe Mode (drivers are missing). If the network you need is not displayed in netsh wlan show profiles, connect to it in normal mode at least once, then repeat the procedure.
6. How to protect your passwords from this type of hacking
If you administer a network (for example, in an office or home router), it is worth knowing how protect against password extraction via CMD. Here are 4 effective methods:
- 🔐 Use WPA3 instead of WPA2 - in this standard, passwords are stored in a more secure form (although they can still be extracted at the OS level).
- 👥 Set up a guest network For temporary devices, its password will not be saved in the system.
- 🛡️ Disable saving passwords In Windows: Go to
Settings → Network & Internet → Wi-Fi → Manage known networks, select the network and click "Forget". - 🔄 Change your password regularly on the router (once every 3-6 months) - this will reduce the risk of leakage even if someone finds out about it.
For corporate networks the best solution is WPA2-Enterprise with authentication via Radius server (For example, FreeRADIUS). In this case, the password is not stored on users' devices, and access is controlled centrally.
If you are using a router from a provider (for example, Rostelecom, Beeline, MTS), check if it is turned on "Password as on sticker" mode - Some models automatically reset the password to factory settings upon reboot.
FAQ: Frequently Asked Questions
Is it possible to find out the password for a Wi-Fi network that the computer has never connected to?
No, this method only works for networks saved in Windows profiles. To obtain the password for someone else's network, you need physical access to the router (sticker, web interface) or specialized equipment (e.g. Wi-Fi adapter with monitoring mode and the program Aircrack-ng), which is illegal without the owner's permission.
Why does CMD show the password as dots (••••••••)?
This is a feature of some versions of Windows (more common in Windows 10 Pro for Workstations or corporate builds). Solutions:
- Use
PowerShell- it displays the password in clear text. - Copy the line with the dots into Notepad - sometimes the characters display correctly when pasted.
- Check the password in the router's web interface (
192.168.0.1or192.168.1.1).
Does this method work on MacOS or Linux?
No, in MacOS And Linux other commands are used:
- 🍎 MacOS: Open Terminal and type
security find-generic-password -wa "NETWORK_NAME". - 🐧 Linux: Use
sudo cat /etc/NetworkManager/system-connections/NETWORK_NAME | grep psk=(For Ubuntu/Debian) orsudo grep psk= /etc/wpa_supplicant/wpa_supplicant.conf(For Arch Linux).
Is it possible to find out the password from an Android or iPhone phone?
On Android (versions 10+) you can view the password through Settings → Wi-Fi → Network name → Share (you will need to enter the device PIN). iPhone (iOS) there is no built-in method - you need jailbreak or third-party utilities like WiFi Passwords (requires root rights).
What should I do if my router isn't assigning an IP address (the "No Internet Access" error appears)?
The problem isn't with the password, but with the DHCP settings. Try this:
- Reboot your router (turn off the power for 30 seconds).
- On your PC, run the following in CMD:
ipconfig /release→ipconfig /renew. - Check if the DHCP server is enabled in the router settings (usually in the section
LANorDHCP).