How to Get Windows Product Key from PC
In this article
You can retrieve your Windows product key directly from the computer if it was pre-installed by the manufacturer or activated via a digital license linked to your Microsoft account. For modern versions of Windows (10 and 11), the key is often embedded in the motherboard's BIOS/UEFI firmware, meaning you do not need to purchase a separate key to reinstall the operating system. If you have a retail key or need to verify the specific alphanumeric string used for activation, you can extract it using built-in command-line tools or by accessing the Windows Registry. This process requires no third-party software and works on most standard Windows installations.
What You'll Need
- A Windows PC running Windows 10 or Windows 11
- Administrator privileges (you must be logged in as an admin)
- Command Prompt or PowerShell (built into Windows)
- Optional: A text editor like Notepad for saving the output
Step-by-Step
- Open Command Prompt as Administrator: Press the
Windows Key + Son your keyboard to open the search bar. TypecmdorCommand Prompt. In the search results, right-click on Command Prompt and select Run as administrator. If prompted by User Account Control, click Yes. - Enter the WMI Command: In the black Command Prompt window, type or paste the following command exactly as shown, then press
Enter:
wmic path softwarelicensingservice get OA3xOriginalProductKey
- Read the Output: Wait a few seconds for the command to execute. The system will query the Windows Management Instrumentation (WMI) service. If a valid product key is embedded in your hardware, it will appear on the line below the command header. It will look like a 25-character string divided into five groups (e.g., XXXXX-XXXXX-XXXXX-XXXXX-XXXXX).
- Note the Key: Write down this key immediately. If the command returns nothing or an error, it means the key is not stored in the BIOS, which is common for computers where Windows was installed manually using a retail USB drive or digital license rather than pre-installed by the OEM.
Common Mistakes
One frequent error is attempting to run the command without administrative rights. Standard user accounts do not have permission to access the licensing service layer, resulting in an "Access Denied" message. Always ensure you select Run as administrator.
Another mistake is confusing the product key with the product ID. The product key is the 25-character code used for installation and activation. The product ID is a different identifier shown in Settings > System > Activation. Do not try to use the Product ID to reinstall Windows; it will not work.
Users also sometimes expect this method to work for all scenarios. If you bought a standalone retail key online and typed it in during setup, it may not be saved in the BIOS. In such cases, the command above will return blank. You must locate the original email receipt or packaging for that specific key.
Tips
Digital Licenses vs. Keys: On Windows 10 and 11, Microsoft often uses a "Digital License" tied to your Microsoft Account or hardware hash. If you see a message saying "Windows is activated with a digital license," you may not actually need the 25-character key anymore. Reinstalling Windows on the same machine will automatically reactivate it when connected to the internet.
Save the Output: If you want to save the key for later reference, you can redirect the output to a text file. In Step 2, instead of just pressing Enter, type the following command:
wmic path softwarelicensingservice get OA3xOriginalProductKey > C:\mykey.txt
This creates a file named mykey.txt on your C: drive containing only the key.
Registry Method for Retail Keys: If the WMI command fails but you know you entered a key manually, you can try reading it from the registry. Open regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform. Look for the BackupProductKeyDefault value. Note that this field is often empty on modern systems unless a specific legacy condition exists, so the WMI method is generally more reliable.
Troubleshooting
The command returns nothing: This usually indicates that the computer does not have an OEM key burned into the motherboard. This happens if you installed Windows yourself using a USB installer. To resolve this, check your email for the purchase confirmation from Microsoft or the retailer where you bought the key. If you cannot find it, you may need to purchase a new key or use a generic key to install Windows, then activate it with your Microsoft Account if you have a digital entitlement.
Access Denied error: Ensure you are running the Command Prompt as an Administrator. Close the window completely and reopen it using the right-click method described in Step 1.
Invalid format or garbled text: If the output looks corrupted, try using PowerShell instead. Open PowerShell as Administrator and run:
Get-CimInstance -Query 'SELECT * FROM SoftwareLicensingService' | Select-Object OA3xOriginalProductKey
Activation Issues After Hardware Change: If you change major components like the motherboard, the embedded key may no longer match the hardware signature. Go to Settings > Update & Security > Activation. Click Troubleshoot. Sign in with your Microsoft Account and select I changed this device's hardware recently to transfer the digital license to the new hardware.
Frequently Asked Questions
Can I get my Windows key from a laptop that won't turn on?
No. If the PC cannot boot, you cannot run commands. However, if it is a branded laptop (Dell, HP, Lenovo, etc.), the key is likely embedded in the motherboard. You can often find the model number on a sticker on the bottom of the laptop and enter it on the manufacturer's support website to retrieve the associated OS key.
Does this work for Windows 7 or 8?
The WMI command provided works for Windows 8, 8.1, 10, and 11. For older systems like Windows 7, the key might be stored differently or require third-party tools if it is not visible in the BIOS. Microsoft has largely deprecated support for these versions, so relying on the original purchase media is recommended.
Is it safe to use these methods?
Yes. Using Command Prompt and WMI commands to read system information is a built-in Windows feature. It does not modify your system, delete files, or pose any security risk. Avoid downloading third-party "key finder" software from unknown websites, as these can contain malware.
What if I lost my Microsoft Account password?
If your Windows license is tied to a Microsoft Account and you cannot access that account, you cannot easily transfer the digital license to a new device. You will need to recover your Microsoft Account password via Microsoft's online recovery page before attempting to troubleshoot activation issues.
Can I use this key on another computer?
It depends on the license type. If the key is an OEM key (embedded in the BIOS), it is permanently tied to that specific motherboard and cannot be transferred. If it is a Retail key, you can transfer it to another PC, but you must deactivate it on the old one first.