We investigated the effect of diet quality on resource allocation in zebra finches (Taeniopygia guttata) by providing females with a high–quality (HQ) or low–quality (LQ) diet for six weeks prior to pairing, and continuing these diets during egg laying and chick rearing. Diet treatments were then reversed and the experiment repeated. When females laid on the HQ diet, egg mass increased with laying order, but the reverse was true on the LQ diet. Females laid significantly more male eggs on the LQ diet compared with on the HQ diet. In addition, female eggs were more frequent at the end of the clutch when on the HQ diet and at the beginning of the clutch when on the LQ diet. These differences in the primary sex ratio are in line with predictions from sex allocation theory, since in this species females are more vulnerable to nutritional stress than males.