Find Windows Product Key

For (possibly) all versions of Windows. Tested on Windows 10 and 11.
To show information about the product key (including the last 5 characters) use command slmgr /dlv in PowerShell or Command Prompt.

NOTE: Always double check using the above command that the extracted product key is the one used by the system. If, for example, the product key has been changed due upgrading from Windows Home to Windows Pro the product key found might be the old one. If that is the case, continue with other methods.

Instructions
Get product key from PowerShell (Simple)
  1. Open PowerShell
  2. Enter command (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
  3. The product key will be printed in the format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Get product key from Command Prompt (Simple)
  1. Open Command Prompt
  2. Enter command wmic path softwarelicensingservice get OA3xOriginalProductKey
  3. The product key will be printed in the format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Get product key from registry (Advanced)
Extract using PowerShell
  1. Open PowerShell
  2. Enter command ((Get-ItemPropertyValue -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name DigitalProductId) | ForEach-Object ToString X2) -join ','
  3. Copy the output (pairs of two letters or numbers separated by commas) and paste into the "Text" box below
  4. Press the "Decode" button and the product key will be shown in the format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Extract using the Registry Editor
  1. Open the Registry Editor (regedit)
  2. Enter path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion in the location bar
  3. Right click "CurrentVersion" to the left and click "Export"
  4. Save as a file and upload the file below
  5. Press the "Decode" button and the product key will be shown in the format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Decoder

Copied!