A ball is out of bounds when all of it crosses the white-stake boundary. It costs stroke and distance — or a fairway drop under Local Rule E-5 when the course uses it.
What counts as out of bounds?
A ball is out of bounds when all of it comes to rest beyond the boundary — white stakes, a fence, or a line painted on the ground. One millimeter inside counts as in bounds.
The penalty: stroke and distance
Under Rule 18.2, an out-of-bounds ball costs you stroke and distance: go back to where you played the shot, add one penalty stroke, and play again.
Local Rule E-5 (casual play)
Many courses adopt Model Local Rule E-5 for pace of play: instead of going back, you can drop in the fairway at the nearest point within two club-lengths of the fairway edge, no nearer the hole, for a two-penalty-stroke total.
Play a provisional ball first
If your ball might be OB or lost, play a provisional ball before you go looking (Rule 18.3).
Quick answers
What is the penalty for hitting a golf ball out of bounds? Stroke and distance: replay from where you last played, adding one penalty stroke (Rule 18.2).
Are white stakes out of bounds in golf? Yes.
What is Local Rule E-5 in golf? An optional pace-of-play local rule: drop in the fairway for two penalty strokes total instead of going back.
Is a ball on the line out of bounds? The boundary line itself is out of bounds; the course side is in bounds.