These days, it's common to install kitchen cabinet doors with Euro hinges, which mount inside the cabinet and behind the door and have two adjustment screws. If your cabinet door won't close, and it has this type of hinge, straightening the door is usually just a matter of tightening some screws.
When a door is visibly off level and has surface mount or another type of non-adjustable hinge, you may have to level the door by resetting one of the hinges to make it close. Usually, this is only necessary if the doors weren't installed level in the first place.
If a door closes, but won't stay closed, the entire cabinet — or the house — may be off level. In this case, instead of trying to fix that, you should just install a better door catch.
When Self-Closing Cabinet Hinges Need Adjusting
Typically, a Euro hinge installs into a recess in the back of the door, so there's no way the hinge itself can go out of alignment. Often, the problem is that the rear adjustment screw has come loose, which makes the door sit askance. For self-closing cabinet hinges, adjusting the door until both the top and bottom are the same distance from the cabinet face should be done first. Then, tighten the screw with a screwdriver.
The front adjustment screw controls the distance between the hinge and the side of the cabinet. When this distance is too great, the cabinet door won't close because it's tilted. Simply turn this screw counterclockwise to reduce the distance and straighten the door. Alternatively, you can widen the space on the other hinge if the gap between the doors is larger than about 1/4 inch, which is what it should be.
Resetting Doors with Non-Adjustable Hinges
If the doors have non-adjustable hinges and one of them wasn't installed correctly, the door won't be level and won't close properly. To reset the hinge, you'll have to move it a very short distance. To avoid driving the screws into the existing holes, you should fill them with epoxy wood filler. Don't use conventional wood filler because it will probably chip out when you drive the screws.
It's a good idea to take the door down and refill the holes for both hinges. After the filler sets, hang the door as if you were doing it for the first time. If the door has surface-mount hinges, have a helper hold it in place in the closed position, making sure it's level and the gap between the doors is straight, and about 1/4-inch wide, while you drive the screw holes with an 1/8-inch drill bit.
If the door is level, but the gap between the doors isn't straight, you'll have to reset the opposite door, as well. If the cabinet has only one door, and the edge of the door isn't straight with respect to the cabinet's edge, then the cabinet is out of level. In this case, it's probably a good idea to re-level the cabinet.
The Cabinet Door Pops Open
When you have an older house with older cabinets, and one of the cabinet doors pops open, it might be because the cabinet or the house is out of level. Both problems call for a fairly major remodel, but in the meantime, you just want the cabinet door to stay closed. To do this, just install better door clasps.
The best clasps are the ones with a triangular prong that fits inside a spring-loaded receptacle. Magnetic door closers are also effective. But if things are seriously out of level, the magnets may not be strong enough to hold the door. Replace the magnetic part of the clasp, which mounts on the side of the cabinet facing, with a small neodymium magnet that you can get at most hardware stores.