Things You'll Need
When you have a shelf that you would like to fit to a wall, you may realize that though the shelf is entirely level, the wall itself is not. If a wall is warped or bowed, the shelf will stand away from the wall. Not only does this look unprofessional, it can weaken the shelf's structural integrity. If you want your shelf to sit flush against the wall, scribe the edges using a pencil to get a close fit.
Set your shelf against the wall where you want to put it, holding it as level as you can.
Lay a sharpened pencil against the wall perpendicular to the shelf with the point set against the shelf itself. At this point, you have the shelf against the wall, the pencil's shaft against the wall, and the point of the pencil pressed to the top of the shelf.
Drag the pencil along the wall, keeping the shaft flat to the wall and allowing the tip to leave a line on the shelf. As the shaft of the pencil passes over an uneven place in the wall, it causes the line drawn on the board to skip, outlining the uneven parts of the wall.
Cut along the pencil line using a table saw. The line drawn on the shelf reflects the unevenness of the wall, and the cut you make will also be uneven, allowing you to match the shelf to the wall. At this point the shelf is ready to be fitted to the wall.
Using only a pencil works well if the unevenness of the wall is slight. If the wall is very uneven, put the pencil into a compass and press the point of the pencil to the board and the sharp tip of the compass to the wall. When the point of the compass is dragged over an uneven part of the wall, it causes a skip in the pencil line as well.