In this paper we analyze the optimal degree of centralization for the supply of public goods. We identify the reliance on an exclusion mechanism as a central feature of the decentralized provision of public goods. An exclusion mechanism induces a contest between users of the public goods who want to free ride and the providers who want to exclude free riding. This contest explains the costs of decentralization. A centralized contribution does not rely on an exclusion mechanism to finance the public goods but on taxation which induces different types of transaction costs. A comparison of the relevant distortions explains the optimal degree of centralization of the supply of public goods.