We provide a model of bookbuilding in IPOs, in which the issuer can choose to ration shares. We consider two allocation rules. Under share dispersion, before informed investors submit their bids, they know that, in the aggregate, winning bidders will receive only a fraction of their demand. We demonstrate that this mitigates the winner's curse, that is, the incentive of bidders to shade their bids. It leads to more aggressive bidding, to the extent that rationing can be revenue-enhancing. In a parametric example, we characterize bid and revenue functions, and the optimal degree of rationing. We show that, when investors' information is diffuse, maximal rationing is optimal. Conversely, when their information is concentrated, the seller should not ration shares. We determine the optimal degree of rationing in a class of credible mechanisms. Our model reconciles the documented anomaly that higher bidders in IPOs do not necessarily receive higher allocations.