We study credit ratings on subprime and Alt-A mortgage-backed-securities (MBS) deals issued between 2001 and 2007, the period leading up to the subprime crisis. The fraction of highly rated securities in each deal is decreasing in mortgage credit risk (measured either ex ante or ex post), suggesting that ratings contain useful information for investors. However, we also find evidence of significant time variation in risk-adjusted credit ratings, including a progressive decline in standards around the MBS market peak between the start of 2005 and mid-2007. Conditional on initial ratings, we observe underperformance (high mortgage defaults and losses and large rating downgrades) among deals with observably higher risk mortgages based on a simple ex ante model and deals with a high fraction of opaque low-documentation loans. These findings hold over the entire sample period, not just for deal cohorts most affected by the crisis.