Female yellow dung flies Scathophaga stercoraria oviposit on the dung surface, which is extremely uneven and other eggs are often already present. We examined the effects of these features on egg placement. We found that: 1. females preferred to lay on small hills on the dung surface and avoided depressions and points; and 2. they ignored the presence of other eggs. These results were confirmed in a field experiment, where the pattern of egg distribution on artificially formed dung pats was consistent with the predictions from the laboratory results. We further showed that survival to adult emergence was best when laying sites were experimentally manipulated so that the eggs were apparently laid on small hills, avoiding the drying effects of small points in the dung and possible drowning by (simulated) rain when laid in depressions in the dung surface. A female dung fly is clearly capable of making subtle decisions about the placement of her eggs, thus increasing her reproductive success.