IKEA recommends that all bookshelves taller than three feet or installed in homes with small children be bolted to the wall for safety--they could be a hazard if they were to tip over. Using included wall fasteners or your own, secure your IKEA bookcase to the wall for support to ensure that they don't get knocked over accidentally or during an earthquake.
Remove all of the items stored on the top shelf and the shelf directly below the top shelf.
Place a right-angled bracket on each end of the top shelf so the bracket rests on the top of the shelf and against the wall. Mark all four mounting holes on the wall and the bookshelf with a marker. Set the brackets off to the side.
Drill a hole though each mark on the wall. If the hole does not go into a stud, drill the hole large enough for a wall anchor. If the hole does go into a stud, drill the hole half the diameter of the bolt you plan to use to secure the bracket to the wall.
Drive the anchor into the wall with a hammer. If your hole is in a stud, forgo this step.
Drill the holes in the top of the bookshelf with a hand drill. Drill the hole large enough to fit the bolts you plan to use to secure the bracket to the shelf.
Place the brackets back onto the shelf and line up the mounting holes over the drill holes.
Secure the bracket to the wall by driving the bolts into the wall anchors with a socket and ratchet.
Place a washer over each bolt, then place the bolts through the bracket and shelf. Place a washer on each bolt protruding through the bottom of the shelf. Secure all bolts with a nut tightened by the matching-sized socket wrench.
Wipe off any sawdust or drywall powder generated during drilling. Replace your objects on the shelf.