If you’re totally ready to start drilling into the wall for your next DIY project, hit the brakes. Installing a few framed photos or even mounting a TV might sound simple enough, but every year thousands of unlucky homeowners learn this lesson the hard way: You should never—and we mean never—drill into a wall when you don’t know what’s behind it.

Most homes have a number of pipes and wires running through any given wall, and unless you know how to find them, you risk injuring yourself, seriously damaging your home, or both.

So before you get that drill all revved up and ready to go, check out these safety essentials and learn how to avoid a DIY nightmare.

Pay attention to light switches and sockets

“The main dangers [of drilling into a wall] are hitting an electrical wire, water pipe, or gas pipe,” explains Issabel Williams, a crew member with Fantastic Handyman. “All of these scenarios can lead to electrocution or flooding.”

Fortunately there are a few tricks to help you determine what’s behind a wall without risking electrocution.

Electrical wires, for example, tend to follow a certain pattern of placement.

“One common rule is to avoid drilling around light switches and sockets, as the electrical wires can go horizontally and vertically around these fixtures,” Williams explains. “You can also get an idea of where wires and pipes run by looking in the attic and basement to see where they go up or down through framing.”

Use a stud finder

It’s also a good idea to invest in a stud finder before you start any sort of project that involves drilling into walls. A stud finder will help you locate studs, which are the vertical beams that frame and support your house.

“Electrical wires often run vertically along studs,” says Matt Daigle, founder and CEO of sustainable home improvement site Rise. “A stud finder is a convenient hand-held tool that makes locating studs hidden behind drywall a quick and easy task.”

To find a stud, simply power on your device and move it horizontally until it indicates a stud. Mark the stud location in pencil, and keep moving along the wall to find more studs (if necessary). Since studs are typically spaced 16 to 24 inches apart, you won’t have to search very long to find your first one.

Be sure to invest in the right kind of stud finder, though. Although magnetic (nonpowered) stud finders are available, Daigle cautions against them.

“Magnetic stud finders are ideal for commercial buildings where metal studs are commonly used,” he says, “but they’re far less accurate at home.”

Make sure the batteries in your stud finder are up to snuff as well, because low batteries can cause errors.

Be careful with walls that connect to your bathroom or kitchen

While finding wires can be a relatively straightforward process, locating pipes is a bit trickier. One rule of thumb is to be especially careful when drilling into any walls that connect to your bathroom or kitchen—basically, any wall that’s likely to have pipes.

If you do hit a pipe, Williams says, you’ll probably know it.

“Even if the pipe is soft metal, it’s still going to offer a substantial amount of resistance,” Williams says. “And unless you hit it where it passes through a stud, your drill bit will probably deflect off of the curved surface.”

Know when to call in the professionals

The trickiest part about hanging heavy objects is that they may require a stud for stability. Hanging a heavy object off a stud can be done, but you need to know how thick the stud is, as well as how the wires are attached to it.

This can vary quite a bit based on the year your home was built and the level of expertise that went into building it. If other parts of your home seem like they were designed by an amateur, you shouldn’t be surprised if there are hidden inconsistencies behind the walls as well.

And although your walls might seem sturdy enough—stud or not—don’t turn your drywall into Swiss cheese trying to hang heavy objects.

“Drywall is not as supportive as concrete or brick walls, so if you want to hang something, it’s imperative that you first check where the studs are,” Williams says. “Otherwise you risk having a serious accident with falling objects.”

Unless you’re hanging a very lightweight frame (that doesn’t require a stud)—or confident in your abilities to hang something larger off a stud without disrupting any wires—you should consider hiring a professional to help you get the job done.