I threw out a Windows XP machine a while ago (the motherboard failed). I kept the hard drive and the XP installation media.

Problem is the license key was on a sticker on the machine - doh! The original manufacturer has gone bust (Evesham) and I suspect that Microsoft will be of little help.

Is there any easy way to get the license key off the hard disk? Can I just find the file with the registry data in it and get the key using a hex editor?

I really need a spare XP key for use in a Windows VM.

  • Keep in mind that most OEM XP and up license key stickers were special numbers to begin with. You can't usually reinstall with that number, and I believe the number in the registry reflects the number on the case. Aug 30, 2009 at 15:06
  • 1
    Note that Fortyrunner has said that the registry is on ANOTHER disk from another computer. Using Jellybean/WinKeyFinder/KeyFinder as suggested will not work in this instance.
    – Kez
    Aug 30, 2009 at 17:19
  • and why would winkeyfinder not work? connect the HDD to any computer (to be sure, remove all other HDDs), now boot from a windows XP CDROM and run a repair installation, then retrieve your license keys with winkeyfinder. walk in the park.
    – Molly7244
    Aug 30, 2009 at 21:02

5 Answers 5


If the old machine had a sticker, it was most likely an OEM license.

OEM licenses cannot legally be moved from one computer to another one. They die when the computer dies.

But, in answer to your question...

Load the old registry hive on your new computer and then find the XP key. -- EDIT make sure that you open the SOFTWARE hive instead of SYSTEM mentioned in the first guide, then open this just-opened-offline hive in the second guide.

  • 1
    After further reading, if you have never reinstalled XP with the key on the sticker - you are unlikely to retrieve it by any means. OEM's usually use a generic key (not the one on the sticker) so that is the one that you would get from the registry.
    – Kez
    Aug 30, 2009 at 17:21

Apparently Nirsoft's ProduKey can do this:

produkey.exe /windir [Windows Directory]

Load product key information from another operating system on the same computer. The [Windows Directory] specifies the base folder of Windows installation, for example: c:\windows, c:\winnt This feature is only supported on Windows 2000/XP/2003/2008/Vista/7.

If that doesn't work, you'll have to dig it out of the registry file manually by searching

for the registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId

using a hex editor I think.

Bytes 52-66 (0x34 - 0x42) of this key hold a 15 byte number.

In Hex, it's a 30 digit number: A2 23 51 D0 2A 38 5D 22 C4 41 6B 87 43 C1 00

In Binary, a 120 digit number: 10100010 00100011 ... 11000001 00000000

Converted to base 24: 751AA001EHCCLAB3JH8KDIGAG

Mapped to Microsoft's custom base24 alphabet "BCDFGHJKMPQRTVWXY2346789" and a hyphen every 5 chars:


I did it this way about 4 years ago, so I'm really hoping ProduKey works.

  • Converting your example to Base 24 actually yields a 27-character string (CDKHCQQBBCW2TT7QRF42M6V3YQY), but it looks like you discard the extra characters from the beginning.
    – palswim
    Sep 16, 2021 at 18:21

WinKeyFinder - · View Windows XP CD Key · Change Windows XP CD Key · View Windows Vista 32bit Edition CD Key · View MS Office 2007 CD Key · View/Change XP Key · View/Change MS office Key · View Win98 Key · view Win2000 Key · View .Net Key · View Windows2003 Key

Magic Jelly Bean Keyfinder works on Windows 95, 98, ME, 2000, XP, Vista, Server 2003, Server 2008, Office XP, Office 2003, and Office 2007 family of products.

and while you're at it, backup your XP activation files, AFAIK the latest WinKeyFinder features this option, if not, here'a a tutorial.


This article might be useful: Find the Windows XP Product Key Code.
There is also this another link on a ViewKeyXP tool: Retrieve your XP Product Key.
(that second link has some other tool references too).


If you are able to extract the 15 bytes from positions 0x34 and 0x52 (52-66) in the DigitalProductId Registry Value as a Hex string, you can use the following Python (Python 3) script to convert the bytes to a Product Key:

import sys

def eprint(s, *args, **kwargs):
    sys.stderr.write(s.format(*args, **kwargs) + '\n')

class KeyConv(object):
    _alphabet = 'BCDFGHJKMPQRTVWXY2346789'
    def __init__(self, val, verbose = False):
        self._val = val
        self._verbose = verbose

    def _int_to_indices(cls, val):
        while (val > 0):
            yield (val % len(cls._alphabet))
            val = val // len(cls._alphabet)

    def key(self):
        a_idx = list(self._int_to_indices(self._val))
        s_key = ''
        for i in range(0, (25 - len(a_idx))):
            s_key = s_key + self._alphabet[0]
        for idx in reversed(a_idx):
            s_key = s_key + self._alphabet[idx]

        if len(s_key) != 25:
            if self._verbose:
                eprint('Invalid Product Key length: {} ({}) from 0x{:X}'.format(len(s_key), s_key, self._val))
            s_key = s_key[-25:]
        chunks_key = (s_key[(5 * pos):((5 * pos) + 5)] for pos in range(0, 5))
        return '-'.join(chunks_key)
    def from_hex_string(cls, shex, *args, **kwargs):
        return cls(int(shex, 16), *args, **kwargs)

if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser(description="""Decode a Windows Registry value to the corresponding Product Key""")
    parser.add_argument(dest='hexstring', help="""The hex string to decode (from the Registry)""", metavar='STRING')
    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help="""Output more information about conversion""")
    args = parser.parse_args()
    k = KeyConv.from_hex_string(''.join(args.hexstring.split()).replace(',', '').replace('\\', ''), args.verbose)

Sample run:

> python3 key-conv.py -v "A2 23 51 D0 2A 38 5D 22 C4 41 6B 87 43 C1 00"
Invalid Product Key length: 27 (CDKHCQQBBCW2TT7QRF42M6V3YQY) from 0xA22351D02A385D22C4416B8743C100

You can see the details about where to find the DigitalProductId Value in another answer, but essentially, look in the Registry Key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

If you cannot access an interface to the machine, but can access the filesystem, find the Registry Hive at:


If you are having trouble extracting the data, you can Export the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion Key and then open the resulting .reg file. If I wanted to expand the script, I could add a Registry or .reg file extraction routine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .