Finding your Windows 11 product key through Command Prompt
You can retrieve your Windows 11 product key directly from your computer using Command Prompt, a built-in Windows tool. The most reliable method uses a PowerShell command that reads the key from your system's registry — the database where Windows stores activation information. This works whether you installed Windows yourself or it came pre-installed on your device.
The command takes about 30 seconds to run and displays your key in plain text on your screen. You do not need administrator access, though some versions of the command work better with it. If you have already activated Windows 11, the key is stored locally and can be retrieved this way.
Key Takeaways
- Open Command Prompt or PowerShell and run a single command to display your product key directly on screen.
- The PowerShell method using WMI (Windows Management Instrumentation) is the most straightforward approach for most users.
- If you see a generic key like "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX", your copy of Windows came pre-activated on your device and does not have a traditional product key.
- Write down or screenshot your key immediately after retrieving it, since you may need it if you reinstall Windows or move to a new computer.
- If the command returns nothing or an error, your Windows installation may not be activated or the key may not be stored in the expected location.
The PowerShell method: fastest way to see your key
Open PowerShell by right-clicking the Start button and selecting "Windows PowerShell (Admin)" or by typing "powershell" into the search bar. Copy and paste this command into the window, then press Enter:
powershell "(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey"
Your product key will appear on the next line as a 25-character string in the format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX. If nothing appears or you see an error, scroll down to the "What if the command returns nothing" section.
The Command Prompt alternative: using wmic
If PowerShell is not available or you prefer Command Prompt, you can use the wmic (Windows Management Instrumentation Command-line) tool instead. Open Command Prompt by typing "cmd" into the search bar, then paste this command:
wmic path softwarelicensingservice get OA3xOriginalProductKey
Press Enter and your key will display below the "OA3xOriginalProductKey" heading. This method works on most Windows 11 systems and does not require administrator access, though running as administrator may improve reliability on some machines.
Understanding what your key result means
If you see a string of X's (like XXXXX-XXXXX-XXXXX-XXXXX-XXXXX) instead of actual numbers and letters, your Windows 11 came pre-installed on your device and is tied to your hardware rather than a separate product key. This is common on laptops and pre-built computers. You can still reinstall Windows on the same device without entering a key — Windows will reactivate automatically.
If you see a mix of numbers and letters, that is your actual product key. Write it down or take a screenshot. You will need this key if you reinstall Windows on the same computer or transfer your license to a different device, depending on your license type.
What if the command returns nothing
If the command runs but displays no key, your Windows installation may not be activated yet, or the key may not be stored in the registry location these commands check. Try running the command as administrator: right-click PowerShell or Command Prompt and select "Run as administrator," then paste the command again.
Another reason for no result is that Windows 11 may be using a digital license tied to your Microsoft account instead of a traditional product key. In this case, your activation is linked to your hardware and account rather than a 25-character key. You can check your activation status by going to Settings > System > About and looking for "Activation status" — if it says "Windows is activated," you do not need a separate key to reinstall.
Saving and protecting your product key
Once you have your key, store it somewhere safe and separate from your computer. Write it in a notebook, save it in a password manager, or store it in a secure cloud location. Do not email it to yourself or leave it in an unsecured document on your desktop.
If you lose your key and your Windows installation becomes corrupted or you need to reinstall, you can still reactivate on the same device if you have a digital license. If you need to move to a new computer, contact Microsoft Support with proof of purchase — they can help transfer your license depending on the type of key you have.
Frequently Asked Questions
Can I use this key on a different computer?
It depends on your license type. Keys that came pre-installed on a device are usually tied to that specific hardware and cannot be transferred. Keys purchased separately can typically be used on one computer at a time, but you may need to contact Microsoft to deactivate it on the old machine before activating on a new one.
What if I see a generic key like KH82J-GUCNQ-etc?
That is a generic or OEM key, meaning Windows came pre-installed on your device. It is not a unique product key you can use elsewhere. Your activation is tied to your hardware, and you can reinstall Windows on the same device without needing a different key.
Do I need administrator access to run these commands?
No, but running as administrator increases the chance the command will work on all systems. If you get an error or no result, close the window and try again with administrator access by right-clicking and selecting "Run as administrator."
Is it safe to share my product key with someone else?
No. Your product key is like a password — treat it as confidential. Sharing it allows someone else to activate Windows using your key, which may violate Microsoft's terms and could cause activation problems if both of you try to use it simultaneously.
What should I do if the command shows an error message?
The most common error is a permissions issue. Close the window and open PowerShell or Command Prompt as administrator, then try the command again. If you still see an error, your Windows installation may not be fully activated or the registry location may be corrupted — in this case, check your activation status in Settings > System > About.