The U.S. tax code is quite complex, so it's no wonder many Americans don't know how their income tax is determined. When calculating the amount of federal income tax you owe, the IRS goes through several steps, such as excluding certain items from your income, applying the current tax brackets, and making adjustments for any tax credits you qualify for.

With that in mind, here's an overview of how the IRS calculates your income tax, so you can get an idea of where your 2017, 2018, and future tax bills are coming from.

IRS tax forms surrounded by money.

Image source: Getty Images.

Step one: Your gross income

First, the IRS starts with your gross income, which includes all of the money that you make. In addition to income from your job, this also includes business income, retirement income, interest income, dividend income, and capital gains from selling investments, just to name some of the most common sources. (Note: long-term capital gains and qualified dividends are considered separately when calculating tax, which I'll get to in a bit.)

As an example, let's say that you earned the following income in 2017:

  • Salary of $50,000
  • Net business profit of $20,000 from doing consulting work
  • Interest income of $5,000

In this case, your gross income for the year would be $75,000. However, you don't pay taxes on your gross income -- this simply serves as the starting point.

Step two: Determining your adjusted gross income (AGI)

Next, certain adjustments are applied to your gross income to determine -- you guessed it -- your adjusted gross income, or AGI. These are also known as "above the line" deductions, because you can use them regardless of whether you itemize deductions or take the standard deduction.

Adjustments to your income include:

  • Deductible retirement contributions to a traditional IRA or to a self-employed retirement plan such as a SEP-IRA (Note: 401(k) and similar plan contributions are generally already excluded from the income listed on your W-2).
  • Student loan interest, up to a maximum of $2,500.
  • K-12 educator expenses, up to $250.
  • Moving expenses, if your move was connected to a new job (discontinued for the 2018 tax year).
  • Alimony paid, although it must be claimed as income by the recipient (discontinued for divorces after December 31, 2018). 
  • Bad debts -- if you're owed money and can't collect.
  • Tuition and fees -- Up to $4,000 if you qualify and don't also claim the American Opportunity Credit or Lifetime Learning Credit.

If any of these apply to you, subtract them from your gross income to arrive at your AGI.

Continuing our example, let's say that your gross income is $75,000 and that you have the following adjustments for 2017:

  • Traditional IRA contributions of $3,000
  • Student loan interest of $2,000

These would be subtracted from your gross income to arrive at an adjusted gross income of $70,000.

Step three: Apply deductions to find your taxable income

Next comes tax deductions. Now, Americans have two choices. They can add up all of the tax deductions to which they're entitled, or they can choose to take the standard deduction.

For the 2017 tax year (the return you filed or will file in 2018), the standard deduction is $6,350 for single filers, and $12,700 for married couples filing jointly. For the 2018 tax year, the standard deduction is increasing to $12,000 and $24,000 for single and joint filers, respectively.

You can choose to take your corresponding standard deduction, or take all of your actual tax deductions, whichever is higher. Mortgage interest, charitable contributions, state and local taxes, and certain medical expenses are some of the most common ones, but there are many other possible deductions.

The majority of Americans use the standard deduction, but it's often a good idea to calculate your taxes using both methods to see which is most advantageous.

For example, let's say that in our hypothetical example with an AGI of $70,000 in 2017, this taxpayer is single and has the following deductions:

  • $5,000 in mortgage insurance
  • $1,500 in charitable contributions
  • $1,000 in state income taxes

This adds up to $7,500, higher than the $6,350 standard deduction for 2017. So, they would use the higher figure, resulting in $62,500 in remaining income.

Step four: Apply your personal exemptions (for 2017 returns only)

There's one more step to determine taxable income for the 2017 tax year -- the personal exemption.

The personal exemption is disappearing after the 2017 tax year as part of the Tax Cuts and Jobs Act, but for 2017 returns, each taxpayer and their dependents are entitled to a $4,050 personal exemption (although this phases out for high-income taxpayers).

So, in our example, this single filer would subtract a personal exemption of $4,050, finally arriving at their taxable income of $58,450.

Of course, if you're reading this in preparation for your 2018 tax return (the one you'll file in 2019), ignore this section.

Step five: Use the tax brackets

Next, your taxable income will be applied to the marginal tax brackets. They're called marginal tax brackets because not all of your taxable income is taxed at the same rate. For example, consider the single tax brackets for 2017.

Tax Bracket

Income Range

Your Tax Is...

10%

$0-$9,325

10% of your taxable income

15%

$9,326-$37,950

$932.50 plus 15% of your income above $9,325

25%

$37,951-$91,900

$5,226.25 plus 25% of your income above $37,950

28%

$91,901-$191,650

$18,713.75 plus 28% of your income above $91,900

33%

$191,651-$416,700

$46,643.75 plus 33% of your income above $191,650

35%

$416,701-$418,400

$120,910.25 plus 35% of your income above $416,700

39.6%

$418,401 and above

$121,505.25 plus 39.6% of your income above $418,400

Data source: IRS.

What this means is that the 10% tax rate will always be applied to the first $9,325 of income, regardless of how much a taxpayer made.

For our example of a single taxpayer with 2017 taxable income of $58,450, the chart shows that they would fall into the 25% tax bracket. Using the formula in the left column tells us that this taxpayer would have a total federal income tax of $10,351.25 for the 2017 tax year.

For reference, here are complete guides to the 2017 tax brackets and 2018 tax brackets. Be sure to use the correct bracket for your filing status.

It's also important to realize that the tax brackets for 2017 tax returns are very different than the tax brackets that will be applied to 2018 returns, so be sure you're looking at the correct tax year.

As far as qualified dividend and long-term capital gains taxes go, they are taxed at different, more favorable rates of 0%, 15%, or 20%, depending on the taxpayer's marginal tax brackets. High-income taxpayers may also have to pay an additional 3.8% net investment income tax on any dividends or capital gains as well.

Step six: Apply any tax credits

We're not quite done yet. The last step is to apply any tax credits to which you are entitled. Unlike deductions, which reduce the amount of your income subject to tax, tax credits reduce the amount of tax you owe dollar-for-dollar.

There are many tax credits available, but some of the most common credits are:

So, let's say that in our example of a taxpayer who has calculated a 2017 federal income tax of $10,351.25, this individual qualifies for a Lifetime Learning Credit of $1,000. This would be subtracted from their tax bill, reducing it to $9,351.25.

How much you'll actually owe the IRS

So, this is how the IRS calculates your tax bill for the year. However, keep in mind that employees pay taxes as they go in the form of paycheck withholdings.

To determine how much you'll actually owe the IRS on Tax Day, take the tax you calculated in step six, and subtract the amount that was withheld from your paychecks for federal income tax for the year. You can generally find this information on your last pay stub for the year, listed under the year-to-date (YTD) column. If this produces a positive number, this is how much you can expect to owe the IRS. On the other hand, if the result is negative (more common), this is how much of a tax refund you can expect to get back.