Introduction: Make a Working Key From Scrap Metal by Reverse Engineering a Lock

Have you lost all of the keys for your lock and need to make a new key from scratch?  Does the locksmith lack a key blank that will fit your lock's keyway? Grab a metal file, some scrap sheet metal, and read on for a rough & tumble do-it-yourself key making guide!
I made mine at http://techshop.ws

Reverse engineering a key from a lock is not that difficult, providing the lock can be disassembled. In order to follow this instructable you will have to have access to the lock itself, which usually means the lock is not locked to begin with. If you're hoping to make a key for a container that is currently locked, you'll have to pick it open first, or research the key making method known as 'key impressioning'.

Step 1: Disassemble the Lock

The filing cabinet lock I was working on had an external housing that needed to be opened before the lock itself could be accessed. It had a set-pin that needed to be drilled out. Drilling the pin slightly off-center with a bit smaller than the pin was enough to prevent it from spinning in place, but disintegrated the pin sufficiently that the housing could be opened without causing undue damage to the rest of the lock. This is not usually a necessary step for standard door locks.

Once the lock has been removed from its housing (door handle, drawer, whatever), there is usually a cover on the top of the lock that holds the pins and springs in place. This cover is often clipped in place and can be removed without damaging anything. In my case, the edges of the pin holes were uncovered, but crimped half-shut and needed to be widened with a drill in order to extract the pins. As you remove the pins, keep them in order front-to-back and keep track of the 'top' and 'bottom' pins. Each pin has a specific shape that allows it to interact with the spring, with the pin above/below it, and/or the key itself, depending on where it is sits in the pin-stack. A helpful tool for keeping things straight is a small piece of paper like a post-it note folded into an accordion shape so that each pin-stack can be laid in its own trough.

Removing the lock core from the sheath is usually a helpful step even if it isn't absolutely necessary. I recommend  removal if at all possible (but don't pull it out until you've removed the pins, or they'll shoot everywhere!) Sometimes the pins cannot be removed except by pulling the core. If this is the case, be careful to expose only one stack of pins at a time, or you'll have some sorting to do when all the pins cascade out of the lock.

Step 2: Take Keyway Measurements

The first step in actually fabricating the key is to make something that will properly fit into the keyway itself, effectively making a keyblank like you would normally be able to purchase from a locksmith. The important measurements involved are:

1. The width of the keyway - the key shouldn't wiggle left and right very much, though a little play is OK.
2. The height of the keyway - the keyblank should push the pins all the way to the roof of the keyway without much play at all.
3. The length of the keyway - the key needs to extend past the deepest pin plus a little extra. Making the keyblank so it extends all the way to the end of the keyway is a safe bet.
4. The location of the keyway wards - little triangles or rectangles chunks that stick out from the left and/or right side of the keyway will require that grooves to be cut along the side of the keyblank in order for it to fit into the keyway.
4. The distance of each pin hole from the front of the lock - this will determine where on the key the cuts for each pin need to be made

Step 3: File a Key Blank to the Proper Dimensions

Select a piece of sheet metal that is as thick as possible without being thicker than the width of the keyway. I used some cheap steel from the innards of a old broken laser printer. Computer towers are probably another likely source for raw material. If you're really in a pinch, you could even make a temporary key out of plastic if you really had to.

The part of the key that should be flush with the front of the lock is referred to as the 'shoulder' of the key, and causes the key to stop at the appropriate depth each time it is inserted into the lock. Using my keychain as a reference, most keys have a shoulder at both the top and bottom of the blade, but if you're making your key by hand you might want to consider passing on the bottom shoulder. I'll discuss that in just a moment.

The bottom of the blade of the key should be perfectly straight. This can be difficult to achieve with hand-filing, I was fortunate enough to have access to a mill, and used that to get a straight line and to ensure that the top and bottom of the blade of my key were parallel to eachother and that the top and bottom shoulders described a line perpendicular to the blade.

If you're in a more dire situation and are filing everything by hand, it would probably be OK to just have one shoulder at the top, allowing you to leave the bottom of the key flat and saving yourself a lot of filing. The advantage of omitting the bottom shoulder is that if the scrap metal you are working with already has a factory-straight edge, you can use that edge as a known flat surface to use as the bottom of your key without having to use a square to check the quality of your filing. This will save you time, and save your filing endurance for the remaining tasks. The drawback would be that the blade of your key will tend to lift slightly when inserted fully into the lock, the top shoulder becoming a pivot point for the forward pressure on the key, and can cause the lock to bind as you turn the key. If you're in a rush to get a key made, that may matter very little, but if you want to make a key that will be in use for years, taking the time to file down the bottom edge of the blade to create a bottom shoulder is probably worth the time and cramped fingers.

Once you have a flat bottom (shoulder or no), scribe a parallel line matching the height of the keyway to indicate how tall the key blade should be. File away all material above that line. If you have metal snips, use them to rough out the dimensions then file down the last little bit. The top shoulder is an absolute must, and should be exactly above the bottom shoulder if you opted to make one. The key blade does need to be slightly smaller than the keyway or it won't fit inside, but it shouldn't be loose enough to rattle around. Of course, you won't be able to tell how well the height of your key blade matches the keyway until you cut grooves to match the lock's wards.

Step 4: Cut Grooves for the Wards Into the Key Blank

Key-blank making factories have special metal-cutting blades to cut these grooves consistently. Unless you have one of these tools, however, things get more complicated. Even though I had access to a milling machine, I didn't have an end mill small enough to cut such small grooves. Instead I used a drill with an abrasive cut-off wheel to grind troughs into the side of the key. The work was pretty coarse, but the quality of the lines isn't very important here. As long as you grind away enough material so the key isn't hindered by the wards of the lock, and you leave enough material on the key so it won't snap, that's good enough. It can get tricky when there are wards on both sides of the keyway, and care needs to be taken to not grind straight through the middle of your key. Fortunately, the blade of the key has more to do with properly lifting the pins than it does turning the lock, so you should be okay. Just do your best.

Towards the end of this process I would grind away a little material, test fit the key in the keyway, and see where there was friction. If the key didn't go all the way into the keyway often there was a small mark on the key where it had gotten stuck and rubbed against the side or top of the lock, indicating where there was a 'high' spot that needed to be filed or ground down a little more. You can be fairly aggressive when filing on the top edge of the blade since most of that will get filed down to the proper height for the pins. It is possible to go too far, but unless you're using a bench grinder, it's unlikely you'll cross that line while trying to get the key blank into the keyway.

Step 5: Mark the Location of Each Pin's Hole on the Key Blank

At this point you should have a key blank that goes smoothly into the keyway and whose insertion is stopped by the shoulder(s) of the key.

The next step is to determine where each of the cuts will be made along the length of the key. Not the depths of the cuts yet, just spacing from from the shoulder(s) towards the tip of the key.

Remove the key blank and using the measurements you took earlier of the pin hole spacing, mark along the blade where each hole will fall along the blade of the key. Alternately you can leave the key in the lock and try to mark the top of the key using a pencil lead or a pin, or something. Maybe you could even sprinkle a dusting of graphite powder into the holes and then pull the key out to see exactly where those holes line up. However you do it, double check your work by sticking the key back into the lock and looking down the pin holes to verify that everything lines up before you start filing.

Step 6: (option 1) Cut the Key to the Appropriate Pin Heights Using Pin Measurements

If you've got access to precision equipment, and have complete trust your ability to 'measure twice, cut once', you can cut the proper pin heights into your key without looking at the lock again. If you don't trust yourself, or don't have access to digital calipers, head to the next step, which will accomplish the same task using low-tech methods.

Even if you do have digital calipers, I suggest using the methods in the next step.


OK, so you've got your digital calipers, a paper to do calculations on, and a steady resolve. Let's do this thing, one pin at a time.

You first need to determine the depth of each cut, or rather, the height of the material that should remain on the key blade at that point. That height will need to be calculated based on the height of the bottom pin that will be placed in the associated pin hole. The height of the cut key at each hole plus the height of the bottom pin needs to equal the distance from the bottom of the keyway to the top of the lock's core.

(bottom of keyway to top of core) - bottom pin's height = height of key at that position

If you have not pulled the core out of its sheath this can still be calculated. In theory you could use a depth gauge (or paperclip) to measure the distance through one of the pin holes from the top of the sheath to the bottom of the keyway, then measure the distance from the top of the sheath to the top of the core by turning the core so it's pin holes no longer line up with the holes in the sheath.

((top of sheath to bottom of keyway) - (top of sheath to top of core)) - bottom pin's height = height of key at that position


Using a micrometer or digital calipers to get these numbers would let you determine exactly where each cut in the key's blade should end. If you have an endmill the same diameter or smaller than the pins (they're pretty small!) you can quickly mill each slot, otherwise you're stuck using a file. I recommend scribing the proper cut depth on the side of the key blade (measure from the bottom of the key!) and then filing (or milling) to just above that line, then slowly fine-tune the depth with a file using the lock and the associated bottom pin to verify the proper depth of the cut. Its probably possible to mill a key precisely enough for the key to work the first time, but I doubt you'd get it right without a fair amount of practice.

Yes, I'm still pushing for you to use the no-measuring method, which works great for a one-time job.

Step 7: (option 2) File the Key to the Appropriate Pin Heights Without Using Pin Measurements

Insert your keyblank into the keyway and put any one of the bottom pins* into its corresponding pin hole. You'll notice that the pin sits taller than the top of the core of the lock. This is easier to see if you've pulled the core out of the lock ... but this isn't strictly necessary. Our goal will be to file away the top of the key just beneath that pin until the top of the pin is exactly flush with the top of the core of the lock. No taller, no shorter. No pressure, but if you mess this up you'll have to start from scratch.

Now, ever so carefully, file a groove in the top of the key for that first pin. The amount of material you will be filing away will be equal to the distance that the pin is sticking up from the top of the lock's core (not the whole height of the pin, not the height of the pin from the top of the lock sheath). Again, this is easier to see when the core has been removed from the sheath. As you file, frequently check the depth of your groove by inserting the key into the lock and checking that the bottom pin you're working with sits closer to the shear line. Be sure the groove you are filing is at least as wide as the pin. If the groove is too narrow, the pin will get caught on the sides of the groove, and if it isn't touching the bottom of the groove you may actually be filing deeper than you should be without seeing the appropriate change how the pin settles into the cut. Also, be careful that you do not file your groove too wide, since this will affect the sloping transitions from one pin height to another that are required for keys to slide smoothly in and out of a lock. We'll talk about those in a moment. Finding a file narrow enough to file these grooves may be tricky. I use the edge of a rectangular jeweler's file, but in a pinch the corner of a larger file can be used, its easier to keep the bottom of your groove parallel to the bottom of the blade if you use a flat file. It is possible to use a larger file tilted at a 45 degree angle, you just have to work more carefully to get a flat bottomed cutout.

As you approach the proper depth, you will find that you can begin to turn the core of the lock within its sheath, but the lock will bind without being able to make a full rotation. This means you are very, very close to the proper height. Continue filing off very small amounts until the key turns smoothly. Taking off a little too much at this point is easy to do, and that will leave you with a key that you have to rattle around in order for it to turn, if it works at all. Be careful! As a check to see if the groove is too deep, put the top pin into the pin hole on top of the bottom pin and see if the key still works. If it doesn't turn when the top pin is inserted, you've gone too far. You may as well start over now on a new key without wasting time filing out the grooves you haven't started yet.

Once you've got one pin working smoothly, repeat this process for the remaining pins. Watch a movie or something, this can take a while depending on the quality of your file.

*I recommend starting this process with your shallowest cut first, that way if you DO end up going too deep on one of your grooves, you can actually swap that bottom pin with a taller pin (whose position on the key has not yet been cut) and continue filing down the groove you're currently working on until you reach the proper depth for the new pin you just swapped in to that position. If you keep working from shallowest cut to deepest cut, you can mess up a couple of times and still end up with a working solution. Do note that no existing keys for the lock will work one you start swapping the bottom pins around (but the whole reason you're doing this is because you don't have any keys, right?)

If there is a disaster of some sort and one of the depths of your keys is definitely too deep, there is one last resort: remove that stack of pins completely: bottom pin, top pin, spring, everything. That significantly reduces the security of the lock, making it easier to pick, and increasing the number of other existing keys that will open your lock just by random chance. You could even remove all of the pins except one, and the lock will still technically work. You'd just better hope nobody ever casually or accidentally tried to 'break in'.

Step 8: File Smooth Transitions Between Each of the Cut Depths

If you look at your keychain, you'll see that each key has nice 45 degree angles between the flat sections that determine the pin depths. These 45 degree angles are to help the key push past the pins until it is fully seated in the lock. If the transitions between pin heights are at too steep an angle, the key will bind as it is inserted into the lock. File down the vertical walls of each groove you've cut so that they have a nice slope to them and won't snag the pins. Missing even one of these can make for a key that either won't go into its lock, or won't come back out once it has been inserted. Be careful not to accidentally file away any of your perfect pin surfaces now that you've gotten this far. Be sure to file an angle on the tip of your key as well. The angle at the tip usually starts just below the highest ward, which pulls double-duty both as a ward and as a way to keep the pins from falling to the bottom of the keyway.

Step 9: Reassemble and Make Final Adjustments

At this point you should have a key with cuts at the proper distances and depths to open your lock. You'll only know if it really works once the lock has been fully reassembled. Go ahead and put all the bottom and top pins back in their respective holes and replace the cover over the pins or re-crimp the holes. If you've taken care to get everything right, your key should work smoothly in the lock.

If it is hard to push the key in or out of the lock, take another look at the angles of the transitions between each pin depth. If any are steeper than 45 degrees, try to smooth them out if possible. Just be sure you don't file away the bed where a pin needs to rest.

If the key does not turn smoothly in the lock, either one of the cuts is not wide enough (the pin may be resting part way up the side of a trough) or there is a problem with the the depth of one of the cuts. You can sometimes tell if a cut is off-center or not quite deep enough because the pin will leave a small indentation on the key. Look for a shiny dot in the marks left by your file. If there is one, try very lightly filing down that one spot. If there are no indentations or markings from the pins, you may have a spot that is too low. There's not much you can do about that other than live with a lock that sticks slightly or try making another key. If the key doesn't turn at all, something is really wrong. Disassemble the lock again and double-check your work from step 7.