I examine teacher preferences using a discrete-choice experiment, which I link to administrative data on teacher effectiveness. I estimate willingness-to-pay for a rich set of compensation elements and working conditions. Highly effective teachers usually have the same preferences as their peers, but they have stronger preferences for performance pay. I use the preference estimates to investigate the optimal compensation structure for three key objectives: maximizing teacher utility, maximizing teacher retention, and maximizing student achievement. Under each objective, schools underutilize salary and performance pay, while overutilizing retirement benefits. Restructuring compensation can significantly improve both teacher welfare and student achievement.