David from Kingston, Nova Scotia had a question about a floating shelf he was trying to build himself, but before answering his question I wanted to show some commercial 'floating' shelves that you can purchase.
Just what is a 'floating' shelf? It is a shelf that appears to have little or not support. The first photo shows a nifty arrangement for a floating corner shelf. The dovetail type bracket is screwed to the wall, and a square one to the other wall. The shelf slides onto the dovetail bracket and sockets over the square bracket. One little screw from below holds it into place.
The second photo shows the brackets that are all over my kitchen. You see the bracket, but just barely. The nice thing about this metal support is that you can easily screw it into two studs for great strength, even though the shelf is not centered on the studs. The little shelf just slips in, and again a little screw from below locks it into place.
The third photo is a kit that provides a very strong shelf with a completely hidden bracket. Again, you can easily screw into at least two studs.
Back to David, who is building home made versions of that last shelf. He is simply putting dowels into the shelf and into the studs. His worry was that a deep quarter inch hole would weaken the stud. No David, you can even make 3/8 or half inch holes and it wouldn't bother the studs much, but try to get your holes centered. The stud is 1-1/2 inch wide and you will be drilling out less than one third of its meat, and then filling the hole back in. One other little trick is to drill the support holes just slightly downhill so that after you slide in the dowels, the weight on the shelf will bend it down to a horizontal position rather than ending up sloping forward and inviting things to fall off the shelf. Practice on the garage wall.