Credit default swaps (CDS) have been growing in importance in the global financial markets. However, their role has been hotly debated, in industry and academia, particularly after the credit crisis of 2008-2009 and the European sovereign crisis of 2010-2012. We review the extant literature on CDS that has accumulated over the past two decades. We divide our survey into seven topics after providing a broad overview in the introduction. The second section traces the historical development of CDS markets and provides an introduction to CDS contract definitions and conventions. The third section discusses the pricing of CDS, from the perspective of no-arbitrage principles as well as from that of structural and reduced-form credit risk models. It also summarizes the literature on the determinants of CDS spreads, with a focus on the role of fundamental credit risk factors, liquidity and counterparty risk. The fourth section discusses how the development of the CDS market has affected the characteristics of the related bond and equity markets, with an emphasis on the closely related concepts of market efficiency, price discovery, information flow and liquidity. Attention is also paid to the CDS-bond basis, the wedge between the pricing of the CDS and its reference bond, and the mispricing between the CDS and the equity market, which leads to a discussion on capital structure arbitrage. The fifth section examines the effect of CDS trading on firms' credit and bankruptcy risk, and how it affects corporate financial policy, including bond issuance, capital structure, liquidity management, and both external and internal corporate governance. The sixth section summarizes the literature that takes into account how CDS may impact the incentives of the various agents in the economy and the associated impact on the pricing of the contracts. In particular, we examine how CDS may alter the debtor-creditor relationship. Section seven reviews the growing literature on sovereign CDS and highlights the major conceptual and contractual differences between the sovereign and corporate CDS markets. In section eight, we discuss CDS indices, especially the role of synthetic CDS index products backed by residential mortgage-backed securities during the financial crisis. We close with our suggestions for promising future research directions on CDS contracts and markets.