Prevent accidents and make your home safer by learning about and fixing these code violations. Many are DIY-able.
5 Common Building Code Violations

Missing or Defective GFCIs
Ground-fault circuit interrupter (GFCI) protection is now required for outlets in the kitchen, bathroom and garage, and for all outdoor circuits. It cuts power to a circuit if it detects a current change, which protects against electrical shocks. A single GFCI at the head of a circuit will protect the entire circuit, so just because an outlet isn’t a GFCI doesn’t necessarily mean it doesn’t have ground-fault protection.
Test for ground-fault protection by plugging a GFCI receptacle tester into any outlet. It’ll detect whether there’s a GFCI on the circuit as well as revealing other wiring problems, like reverse polarity and open grounds.
Test for Missing or Defective GFCIs
A GFCI tester detects a bad GFCI as well as other wiring problems.

Handrails Without Returns
Codes require handrails to have “returns,” meaning they need to turn and end at the wall (photo “Solution” above). Returns keep sleeves and purse straps from getting caught on the end of the rails and causing a fall. Handrails need to be placed 34- to 38-in. above the nose of the stair treads and must be 1-1/4- to 2-5/8-in. thick.
Handrail code violations and solution
Stairways are high accident areas. Up-to-code handrails are important for safety.

Improper Bathroom Venting
Bathroom exhaust fans should vent to the outside, either through the roof or the side of the house — not into the attic (photo “violation” above).
Stick your head into the attic to see how yours is vented. Venting the warm, moist air into the attic can cause rotting in the roof framing and sheathing, and may not properly rid the bathroom of moisture. That leads to mold and mildew.
Bathroom venting violation and solution
Venting to the attic dumps a lot of moisture into that space. Here’s some advice on how to correct this common building code violation yourself, or you can always hire a pro to do it.

Missing Deck Flashing
The ledger board between a deck and the house needs flashing, and omitting it is one of the more common building code violations. Besides that, the ledger needs to be firmly attached (photo “solution” above).
A building inspector informed us that incorrectly installed ledgers are the main cause of problems in do-it-yourself decks because the ledger may pull loose from the house. These decks can actually collapse, especially when loaded with people.
No deck flashing and proper deck flashing
The deck/house joint is a common place for rot. The rot will weaken your deck and structural members in your home, which will require an expensive repair.

Misplaced Smoke Alarms
Codes require a smoke detector on each level of the house and outside each bedroom (photo “solution” above). Codes require new homes to have a smoke alarm in each bedroom, hard-wired with a battery backup and interconnected so if one activates, they all go off.
You should install your ceiling-mounted alarms at least four inches away from walls. Wall-mounted alarms should be four to 12 inches down from the ceiling.
Correctly position your smoke alarms
Smoke alarms are critical life-saving devices in case of fire. Position them according to directions.
FAQ
How can I look up the most up-to-date building codes in my area?
Check the website for your local county of municipal building authority. It usually has a section devoted to local building codes. You can also pay a visit to the building department. If you have trouble applying the codes to your specific home, consult a licensed contractor.
When should I hire a professional to avoid code violations?
Any time you’re remodeling or doing any new construction, you have to follow all applicable codes. It’s in your best interest to at least consult with a contractor to avoid violations, even if you don’t hire the contractor and end up doing the work yourself.