If federal revenues and government spending are equal in a given fiscal year, then the government has a balanced budget. If revenues are greater than spending, the result is a surplus. But if government spending is greater than tax collections, the result is a deficit. The federal government then must borrow money to fund its deficit spending.
The federal debt—also referred to as the national debt—is the sum of all past deficits, minus the amount the federal government has since repaid. Every year in which the government runs a deficit, the money it borrows is added to the federal debt. If the government runs a surplus, it uses the extra money to pay down some of its debt.
The size of a budget deficit in any given year is determined by two factors: the amount of money the government spends that year and the amount of revenues the government collects in taxes. Both of these factors are affected by the state of the economy as well as by the tax and spending policies made each year in the federal budget process.
For example, during tough economic times like the Great Recession, government spending automatically increases because there is an upsurge in the number of people eligible for need-based programs like food stamps and unemployment benefits. At the same time, tax revenues tend to decrease because fewer people are employed and therefore pay less in taxes. Corporations also earn less profit, and they too pay less in taxes. What’s more, lawmakers may intentionally increase government spending during a recession in order to stimulate the economy, even though they know that the result will be a deficit. This line chart shows the size of the deficit or surplus in each fiscal year over several decades.

To finance the debt, the U.S. Treasury sells bonds and other types of securities.1 (Securities is a term for a variety of financial assets.) Anyone can buy a bond or other Treasury security directly from the Treasury through its website, treasurydirect.gov, or from banks or brokers. When a person buys a Treasury bond, she effectively loans money to the federal government in exchange for repayment with interest at a later date.
Most Treasury bonds give the investor—the person who buys the bond—a pre-determined fixed interest rate. Generally, if you buy a bond, the price you pay is less than what the bond is worth. That means you hold onto the bond until it matures; a bond is mature on the date at which it is worth its face value. For example, you may buy a $100 bond today and pay only $90. Then you hold it for five years, at which time it is worth $100. You also can sell the bond before it matures.
There are actually many different kinds of Treasury bonds, but the common thread between them is that they represent a loan to the Treasury, and therefore to the U.S. government. As citizens of a democracy, Americans collectively own the federal government, thus a big portion of the federal debt—the portion that was leant to the government by regular Americans—is actually money that we owe to ourselves!
The federal debt is the sum of the debt held by the public—that’s the money borrowed from regular people like you and from foreign countries—plus the debt held by federal accounts. Debt held by federal accounts is the amount of money that the Treasury has borrowed from itself. That may sound funny, but recall from above that trust funds are federal tax revenues that can only be used for certain programs. When trust fund accounts run a surplus, the Treasury takes the surplus and uses it to pay for other kinds of federal spending. But that means the Treasury must pay that borrowed money back to the trust fund at a later date. That borrowed money is called “debt held by federal accounts;” that’s the money the Treasury effectively lends to itself. One-third of the federal debt is debt held by federal accounts, while two-thirds of the federal debt is held by the public.2
Debt held by the public is the total amount the government owes to all of its creditors in the general public. That includes Americans as well as foreign individuals and the governments of foreign countries.3
Approximately half—the largest portion—of debt held by the public is held internationally by foreign investors and central banks of other countries who buy our Treasury bonds as investments. In 2010, these countries included China, which held the most ($1.1 trillion), followed by Japan ($800 billion), Middle Eastern countries ($173 billion), Russia ($168 billion), Brazil ($164 billion) and Taiwan ($152 billion).4
The next largest portion is held by domestic investors, which includes regular Americans as well as institutions like private banks. (A bank may invest some of its own assets in Treasury bonds.) This portion constitutes over a third of the federal debt.
The U.S. Federal Reserve Bank and state and local governments hold the remainder of the federal debt. (The Federal Reserve's share of the federal debt is not counted as debt held by federal accounts, because the Federal Reserve is considered independent of the federal government. The Federal Reserve buys and sells Treasury bonds as part of its work to control the money supply and set interest rates in the U.S. economy.)

Debt held by federal accounts is the debt that the federal government has borrowed from itself. Trust funds, such as Social Security, Medicare and the Civil Service Retirement Trust Fund, own most of that debt. The Treasury must pay back borrowed money with interest into those trust funds at some point in the future.5
When a trust fund account runs a surplus, the Treasury invests the surplus in Treasury bonds or other Treasury securities. The Treasury does this for a number of reasons. First, it enables the federal government to use trust fund surpluses to finance current spending. But another reason is that Treasury bonds earn interest with very low risk, so it’s a way for trust fund surpluses to earn a return over time—just the way you might invest your own savings in a Treasury bond or other interest-bearing investment.6

The debt ceiling is the legal limit set by Congress on the total amount that the U.S. Treasury can borrow. If the level of debt hits the debt-ceiling limit, the government cannot borrow additional funds without Congress raising the debt ceiling. In this situation, if Congress did not raise the debt ceiling and the Treasury was unable to borrow, it would trigger a shutdown of the federal government and a default on existing loans. Congress has the legal authority to raise the debt ceiling as needed.
The debt ceiling was initially set in 1917 and has been raised dozens of times since then.7,8 In most years, the decision by Congress to raise the limit has been a simple procedure. As shown in the figure below, Congress has voted to raise the debt ceiling on almost an annual basis over the past decade, and in some cases even more than once a year. However, in the midst of current debates about the size of the federal budget and the role of deficit spending, and because of political partisanship, the debt ceiling has become extremely contentious and politicized, as occurred during the 2011 debt-ceiling debate.

There is an on-going debate as to whether the government should limit its ability to borrow. Some consider deficit spending to be a hindrance to the government and the economy, arguing that a deficit only shifts the burden to future generations because it must be paid for eventually, just like any other loan.
Others see deficits as a crucial way for the government to stimulate the economy during an economic downturn. Proponents of this view believe that the role of government is not only to provide services that the private sector won’t, but also to stimulate the economy during economic crises. They argue that deficits are necessary in times of economic hardship, but that during economic booms, budget surpluses should be used to pay down the debt.