Community banks have long played an important role in the U.S. economy, providing loans and other financial services to households and small businesses within their local markets. In recent years, technological and legal developments, as well as changes in the business strategies of larger banks and non-bank financial service providers, have purportedly made it more difficult for community banks to attract and retain customers, and hence to survive. Indeed, the number of community banks and the shares of bank branches, deposits, banking assets, and small business loans held by community banks in the U.S. have all declined substantially over the past two decades. Nonetheless, many community banks have successfully adapted to their changing environment and have continued to thrive. This paper uses data from 1992 through 2011 to examine the relationships between community bank profitability and various characteristics of the banks and the local markets in which they operate. Bank characteristics examined include size, age, ownership structure, management quality, and portfolio composition; market characteristics include population, per capita income, unemployment rate, and banking market structure. We find that community bank profitability is strongly positively related to bank size; that local economic conditions have significant effects on bank profitability; that the quality of bank management matters a great deal to profitability, especially during times of economic stress; and that small banks that make major shifts to their lending portfolios tend to be less profitable than other small banks. Variables within managers' control account for between 70 percent and 96 percent of the total explanatory power of equations explaining variations in performance across community banks.