Panel (a) shows the U.S. federal budget deficit as a percentage of GDP from 1940 to 2013. The U.S. government ran huge deficits during World War II and has run smaller deficits, or a surplus, ever since. Panel (b) shows the U.S. debt–GDP ratio. Comparing panels (a) and (b), you can see that in many years the debt–GDP ratio has declined in spite of government deficits. This seeming paradox reflects the fact that the debt–GDP ratio can fall, even when debt is rising, as long as GDP grows faster than debt. The rising debt–GDP ratio in recent years can be attributed to the aftermath of the 2008 financial crisis when deficits were much larger than average and growth in GDP was well below average.
Source: Office of Management and Budget.