Setup and Configuration

How to View the Password of Wifi? CLI Reveal Tips

Introduction Forgetting a WiFi password is a common frustration, especially when a new device needs to connect to the network and nobody can remember the security key. Many people immediately search for third-party utilities or reset their router, but both app

HowToFixWiFi

Introduction

Forgetting a WiFi password is a common frustration, especially when a new device needs to connect to the network and nobody can remember the security key. Many people immediately search for third-party utilities or reset their router, but both approaches carry risks. Third-party password reveal tools can introduce malware, and resetting a router erases custom settings that may be difficult to restore.

A safer and often faster approach is to use built-in command-line tools already present on your operating system. If your computer has previously connected to the wireless network, the password is likely stored locally in a system profile, keychain, or configuration file. With the right command and the appropriate administrative privileges, you can reveal that stored password in plain text without installing anything extra.

This guide explains How to View the Password of Wifi? using command-line interfaces across Windows, macOS, Linux, and Android. It also covers iOS limitations, router administration pages, legal and ethical boundaries, troubleshooting tips, and security best practices. Whether you are a home user trying to reconnect a tablet or an administrator auditing your own network, these methods provide a transparent way to recover credentials you already have permission to use.

Table of Contents

Is It Legal and Ethical to View a WiFi Password?

Before running any command to reveal a stored wireless password, you should confirm that you have the right to do so. Viewing the password of a network you own, administer, or have explicit permission to access is generally acceptable. Viewing the password of a neighbor’s network, a business hotspot, or any network you have not been authorized to join may violate computer crime laws and acceptable-use policies, depending on your jurisdiction.

Ethically, password recovery should be limited to reconnecting your own devices or troubleshooting a network under your control. It should never be used to gain unauthorized access, share credentials with outsiders, or bypass security controls. If you are using a work-issued computer, check your organization’s IT policy before revealing or exporting network credentials, as some employers monitor or restrict this type of activity.

Throughout this guide, all instructions assume you are the network owner, an authorized administrator, or a user with legitimate access to the saved profile. If you are unsure about your rights, consult your network administrator or legal counsel before proceeding.

Prerequisites Before You Begin

To reveal a saved WiFi password using the command line, several conditions must be met. First, the device you are using must have previously connected to the target wireless network. Operating systems do not store passwords for networks they have never joined, so there will be no profile to query if this is a brand-new connection.

Second, you need administrative or root privileges. Password stores are protected by the operating system because they contain sensitive credentials. On Windows, you typically need an administrator account. On macOS and Linux, you will often need to prefix commands with sudo or authenticate through a system dialog. On Android, many methods require a rooted device or access through ADB with elevated permissions.

Third, you should know the exact network name, also called the SSID. Commands usually require the SSID as an argument, and typos will cause the command to fail or return no results. You can list saved profiles first to confirm the exact spelling, including capitalization and spaces.

Finally, have a secure place to record the password once it is revealed. Avoid pasting it into chat applications, email drafts, or unencrypted notes. A password manager or a physical notebook stored in a secure location is preferable.

Windows: Using Command Prompt and PowerShell

Windows stores wireless network profiles in the WLAN AutoConfig service. The built-in netsh utility can list these profiles and display their security settings, including the stored password in plain text. This method works on Windows 10, Windows 11, and many earlier versions.

Using netsh in Command Prompt

The netsh command is the most direct way to view a WiFi password on Windows. Begin by opening Command Prompt as an administrator. Then list all saved wireless profiles to identify the exact network name.

netsh wlan show profiles

Once you know the SSID, query that specific profile with the key=clear switch. This tells Windows to display the security key instead of masking it.

netsh wlan show profile name="YOUR-SSID" key=clear

In the output, look for the section labeled Security settings. Under that heading, the line Key Content contains the WiFi password in plain text. If the line is missing or blank, the profile may not store a password, or you may not have sufficient permissions to view it.

Using PowerShell

PowerShell can perform the same query by calling netsh or by accessing WMI objects, though netsh remains the simplest approach. A basic PowerShell equivalent looks like this:

netsh wlan show profile name="YOUR-SSID" key=clear | Select-String "Key Content"

This filters the output to show only the line containing the password. If you prefer a pure PowerShell approach without netsh, you can query the MSFT_WLANConnectionProfile class, but parsing the encrypted password from WMI is more complex and generally not worth the extra effort for a simple recovery task.

Step-by-Step Windows Instructions

  1. Press the Windows key, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Type netsh wlan show profiles and press Enter to view saved wireless networks.
  3. Identify the exact SSID of the network whose password you want to view.
  4. Type netsh wlan show profile name="YOUR-SSID" key=clear, replacing YOUR-SSID with the real network name, and press Enter.
  5. Scroll to the Security settings section and locate Key Content.
  6. Record the password shown next to Key Content in a secure password manager.

macOS: Using Terminal and Keychain

macOS stores WiFi passwords in the system keychain rather than in a simple text configuration file. The security command-line utility interacts with the keychain and can retrieve generic passwords, including wireless network credentials, when you provide the correct network name.

Using the security Command

Open Terminal and use the following command structure to search for a WiFi password:

security find-generic-password -ga "YOUR-SSID"

The -g flag tells the utility to show the password, and the -a flag specifies the account or service name, which in this case is the SSID. Because keychain access is protected, macOS may display a dialog asking you to authorize Terminal or Keychain Access to retrieve the item. You may need to enter your macOS user password or use Touch ID.

If the command succeeds, the password appears in the output labeled as password. If nothing is returned, the network may not be saved in the keychain, or you may need to prefix the command with sudo depending on your system configuration.

Step-by-Step macOS Instructions

  1. Open Terminal from Applications > Utilities or by using Spotlight.
  2. Type security find-generic-password -ga "YOUR-SSID", replacing YOUR-SSID with your network name.
  3. Press Enter and authenticate if macOS prompts you for your user password or Touch ID.
  4. Look for the line beginning with password in the Terminal output.
  5. Copy the password carefully and store it in a secure password manager.

Linux: Using nmcli and Configuration Files

Linux distributions handle wireless credentials differently depending on the network manager in use. Most modern desktop distributions use NetworkManager, which stores connection files in a system directory. The nmcli tool is excellent for listing connections, but it does not always print the plaintext password directly. For that, reading the underlying configuration file is usually more reliable.

Using nmcli

Start by listing saved connections to confirm the exact name of the wireless profile:

nmcli connection show

You can also filter for wireless connections only:

nmcli -t -f NAME,TYPE connection show | grep 802-11-wireless

While nmcli can display connection details, the password field is often omitted from standard output for security reasons. If you need the plaintext key, you must read the NetworkManager connection file directly.

Reading wpa_supplicant and NetworkManager Files

NetworkManager typically stores wireless connection profiles under /etc/NetworkManager/system-connections/. Each saved network has its own file, often named after the SSID with a .nmconnection extension.

List the files with:

sudo ls /etc/NetworkManager/system-connections/

Then view the contents of the specific profile:

sudo cat /etc/NetworkManager/system-connections/YOUR-SSID.nmconnection

Inside the file, look for a section labeled [wifi-security]. The line beginning with psk= contains the pre-shared key, which is your WiFi password. On older systems using wpa_supplicant directly without NetworkManager, the configuration may instead live in /etc/wpa_supplicant/wpa_supplicant.conf or /etc/NetworkManager/system-connections/ depending on the distribution.

Step-by-Step Linux Instructions

  1. Open a terminal window on your Linux desktop or server.
  2. Type nmcli connection show and press Enter to list saved profiles.
  3. Identify the exact name of the wireless connection you want to inspect.
  4. List the NetworkManager connection files with sudo ls /etc/NetworkManager/system-connections/.
  5. View the target file using sudo cat /etc/NetworkManager/system-connections/YOUR-SSID.nmconnection.
  6. Locate the [wifi-security] section and copy the value after psk=.

Android: ADB and Terminal Commands

Android stores WiFi credentials in a protected system area that ordinary apps cannot read. On older Android versions, the file /data/misc/wifi/wpa_supplicant.conf often contained network passwords in plain text or obfuscated form. Modern Android versions encrypt this data more tightly and store it in system services that are inaccessible without root privileges.

If your Android device is rooted, you can use a terminal emulator or ADB from a computer to inspect these files. A common approach is:

adb shell

Then, with root access:

su

Followed by viewing the WiFi configuration store:

cat /data/misc/wifi/WifiConfigStore.xml

or on some devices:

cat /data/misc/wifi/wpa_supplicant.conf

Because Android security has hardened significantly, these paths may not exist or may be empty on newer devices. An easier non-root alternative is to use Android’s built-in WiFi sharing feature. If your phone is already connected to the network, you can generate a QR code in Settings under Network & Internet > WiFi, then scan it with another device to view or share the password without touching the command line.

Step-by-Step Android Instructions

  1. Enable Developer Options and USB debugging on your Android device.
  2. Connect the device to a computer with ADB installed.
  3. Open a command prompt or terminal on the computer and run adb devices to confirm the connection.
  4. Enter the device shell with adb shell.
  5. Gain root access with su if the device is rooted.
  6. View the WiFi configuration file using cat on the appropriate path for your Android version.
  7. Locate the SSID and its associated password in the output.

If root access is not available, skip the CLI method and use the QR code sharing feature in Android Settings instead.

iPhone and iOS Limitations

iOS does not provide a native command-line interface, and Apple does not allow users to browse the file system where WiFi passwords are stored. There is no Terminal app on a standard iPhone, and jailbreaking is the only way to gain low-level access, which voids warranties and introduces significant security risks.

The most practical way to view a WiFi password on an iPhone is indirectly. If the same Apple ID is signed in on a Mac, the WiFi password may sync through iCloud Keychain. You can then use the macOS Terminal method described earlier to retrieve the credential. Alternatively, if another device is already connected to the network, it can share the password via Apple’s built-in password sharing feature when both devices are nearby and signed into iCloud.

Router Admin Page Method

When CLI methods fail because the device has never connected to the network, the router administration page is often the best fallback. Most routers store the wireless password in their web-based configuration interface. To access it, connect a computer to the router via Ethernet or WiFi, open a browser, and enter the router’s default gateway address, commonly 192.168.1.1 or 192.168.0.1.

Log in with the administrator credentials. If you have not changed them, they may still be the factory defaults printed on a sticker on the router. Once logged in, navigate to the Wireless, WiFi, or Security settings section. The current network name and password are usually displayed there, sometimes under a label like Pre-Shared Key, Passphrase, or WPA Key.

This method is not command-line based, but it is reliable for recovering a password when no client device has a saved profile. After logging in, consider changing the default administrator password to something strong and unique.

Comparison Table: CLI Methods by OS

Operating System Primary Tool Privilege Required Shows Plaintext Password Difficulty
Windows netsh / Command Prompt Administrator Yes Easy
macOS security / Terminal User password / sudo Yes Easy
Linux nmcli + config files Root / sudo Yes (via files) Moderate
Android ADB + shell Root usually required Sometimes Hard
iOS None natively N/A No Not applicable
Router Web UI Browser Admin login Yes Easy

Tips and Best Practices

Recovering a WiFi password is only half the task. Keeping that password secure is just as important. Use a reputable password manager to store wireless credentials instead of writing them on sticky notes or saving them in unencrypted text files. If you share the password with guests, consider setting up a separate guest network on your router so visitors do not have access to your main LAN and its connected devices.

Change your router’s default administrator credentials immediately after setup. Many routers ship with well-known usernames and passwords that are publicly documented, making them easy targets for attackers. Also, use WPA3 encryption if your router and client devices support it; if not, WPA2-AES is still acceptable, while WEP and WPA-TKIP should be avoided because they are easily cracked.

Regularly audit the list of saved WiFi profiles on your devices. Remove networks you no longer use, especially public hotspots, so your devices do not automatically connect to potentially malicious access points with similar names. Finally, keep your operating system and router firmware updated to patch security vulnerabilities that could expose stored credentials.

Common Troubleshooting Issues

One common issue is receiving an “Access denied” error when running netsh or security commands. This almost always means the terminal is not running with elevated privileges. Close the terminal and reopen it as an administrator or with sudo.

If the command runs but no password appears, verify that you typed the SSID exactly as it is saved, including uppercase and lowercase letters. Wireless profiles are case-sensitive, and a small typo will cause the query to return no results. Use the profile list command first to confirm the exact name.

On Linux, the psk= field may be blank in the NetworkManager file if the system uses a different security backend or if the connection was configured by another user. Check file permissions and ensure you are reading the correct .nmconnection file. On Android, missing files usually indicate that the device is not rooted or that the Android version stores credentials in a location inaccessible through ADB.

Special characters in the SSID, such as quotation marks or spaces, can break command-line syntax. Wrap the SSID in double quotes and escape any internal quotes according to your shell’s rules. If a command still fails, try copying the SSID directly from the profile list output to avoid transcription errors.

Frequently Asked Questions

Can I view the password of a WiFi network I have never connected to?

No. Operating systems only store credentials for networks that have been joined and saved. If your device has never connected to the network, there is no local profile to query, and CLI methods will not reveal the password.

Do these methods work on public WiFi networks?

Only if your device has previously connected to and saved that public network. Even then, you should only view passwords for networks you are authorized to use. Many public networks use captive portals or rotating credentials that are not stored in the same way as home WiFi passwords.

Is it safe to share my WiFi password over text or email?

It is not recommended. SMS and standard email are not always encrypted end-to-end, and intercepted messages could expose your network credentials. Use a password manager’s secure sharing feature or enter the password directly on the device when possible.

Why does the password field show blank on Linux?

This usually happens because NetworkManager does not store the plaintext in a location readable by nmcli, or because the connection file belongs to another user. Reading the .nmconnection file with sudo and checking the [wifi-security] section is more reliable.

Can I use these steps to recover a router admin password?

No. These methods recover wireless network passwords saved on client devices. Router administrator passwords are stored on the router itself. If you forget the admin password, you typically need to reset the router to factory defaults and reconfigure it.

What should I do if I suspect someone is using my WiFi without permission?

Log into your router’s admin page and review the list of connected devices. Change your WiFi password to a strong, unique passphrase, and consider enabling MAC address filtering or hiding your SSID as additional layers. After changing the password, all previously connected devices will be disconnected and will need to re-enter the new key.

Conclusion

Knowing How to View the Password of Wifi? through built-in command-line tools can save time and eliminate the need for risky third-party software. Windows users can rely on netsh, macOS users can query the keychain with security, Linux users can inspect NetworkManager connection files, and Android users with root access can explore system configuration stores. iOS remains limited without a Mac or another synced device, and the router admin page is always available as a fallback.

Use these techniques responsibly. Only recover passwords for networks you own or manage, and never attempt to access credentials you are not authorized to view. Once you have the password, store it securely, update your router’s default credentials, and keep your firmware current. With good habits and the right commands, you can maintain control over your wireless network without compromising security.