Much of education policy focuses on improving teacher quality, but most policies lack strong research support. We use student achievement gains to estimate teacher value-added, our measure of teacher quality. The analysis reveals substantial variation in the quality of instruction, most of which occurs within rather than between schools. Although teacher quality appears to be unrelated to advanced degrees or certification, experience does matter -- but only in the first year of teaching. We also find that good teachers tend to be effective with all student ability levels but that there is a positive value of matching students and teachers by race. In the second part of the analysis, we show that teachers staying in our sample of urban schools tend to be as good as or better than those who exit. Thus, the main cost of large turnover is the introduction of more first year teachers. Finally, there is little or no evidence that districts that offer higher salaries and have better working conditions attract the higher quality teachers among those who depart the central city district. The overall results have a variety of direct policy implications for the design of school accountability and the compensation of teachers.