Critics claim that patent screening is ineffective, granting low-quality patents that impose unnecessary social costs. We develop an integrated framework, involving patent office examination, fees, and endogenous validity challenges in the courts, to study patent screening both theoretically and quantitatively. In our model, some inventions require the patent incentive while others do not, and asymmetric information creates a need for screening. We show that the endogeneity of challenges implies that courts, even if perfect, cannot solve the screening problem. Simulations of the model, calibrated on U.S. data, indicate that screening is highly imperfect, with almost half of all patents issued on inventions that do not require the patent incentive. While we find that the current patent system generates positive social value, intensifying examination would yield large welfare gains. The social value of the patent system would also be larger if complemented by antitrust limits on licensing.