Income Tax 101: How to calculate

It's tax season now, you might use TurboTax or you might use Sprintax if you are an NRA, or you might use HR Block or hire a CPA to help you out.

Do you know how your taxes are calculated? Are you curious about what those terms mean? As a software engineer, I believe even a complex tax return is no more than many functions added up together.

I did some research, wrote some code, and I'll explain how your income tax is calculated. There are more taxes and deductions than I'll cover below but you will be able to get a basic understanding of how it works.

Disclaimer: I'm not a CPA and I don't have accounting background. This article only represents my personal opinions, and should not be taken as financial advice.


According to IRS, any income or wage you received for performing services as an employee of an employer counts as gross income. Therefore Wage = Salary + Bonus + vested RSU

It's easy to see why salary and bonus count, but why would vested RSU count too? It's simply because during the tax year, your employer has already "given" these RSU to you. These RSU are already in your account, so they are part of the "wage".


Income = Wage + Other Income - Contributions. Here, contributions means things like Pre-tax 401K or HSA/FSA because you didn't get those money after tax.

Adjusted Gross Income

Taxable Income or Adjusted Gross Income with abbreviation AGI = Income - Deductions

Deductions is what you need to deduct from your taxable income to avoid paying more taxes. Why make tax reporting so complicated with deductions? For example if you wallstreetbets and lose all your tendies in the stock market, wouldn't you cry "I didn't earn anything this year. Why would Uncle Sam only tax according to my salaries?"


Standard Deduction vs Itemized Deductions: For most people, itemizing what can be deducted is very tedious, and you might not get too much out of it in the end, so federal and state set standard deduction to remove that burden for most people.

Obviously, you can not have it both ways so you either pick standard deduction + some other allowed deductions or only itemized deduction. If you really have a lot to deduct, like you made a lot of investments during the past year, you should probably go with itemized deduction to save more taxes because the amount of itemized deductions outweighs the amount of standard deductions.

That's why TurboTax or other tax reporting software always have the step of calculating which way is the best. For the sake of simplicity, we will use standard deduction in the examples below.

Filing Status

  • Single
  • Married Filing Jointly or MFJ
  • Married Filing Separately or MFS
  • Head of Household (considered unmarried, paid more than half the cost of keeping up a home, and living with your kids)
  • Qualifying Widow(er) with Dependent Child

For the sake of simplicity, we'll use Single Filing Status below.

Marginal Tax Rate

As you may know, income tax has brackets. For example, 0 to $9,875 is taxed at 10%, and every extra penny from $9,876 to $40,125 is taxed at 12%. More income will be taxed more, but it won't affect how all the income below the extra part is taxed.

The tax rate for each bracket is what we call marginal tax rate.

Effective Tax Rate

If you add up all the taxes from each tax bracket, and then divide it by your income, you get effective tax rate, which just means what's the overall tax rate everything considered.

For example, if your income is $10000, you will be taxed $9,875 * 10% + ($10,000-$9,875) * 12% = $1,002.5 Effective tax rate is then $1,002.5/$10,000=10.025%

Alrighty, we finally reached the part of actual calculations. Assume you are a Single software engineer in California, with income + bonus + RSU - 401k = $150,000. You don't have any other deductions and will use standard deduction.

First, Federal Income Tax

For 2020 tax season:

For an income of $150,000, we first need to deduct standard deduction of $12,400 (2020 single), $150,000-$12,400=$137,600. We got AGI 137,600

Then for federal income tax $14,650.5+($137,600-$85,525)*24%=$27,148.5 So we need $27,148.5

Next, FICA Tax

FICA stands for the Federal Insurance Contributions Act. It's comprised of Social Security Tax and Medicare Tax. Note: FICA is calculated based on Wage, so our base is $150,000.

Social Security Tax, according to the balance, for 2020 Social Security Tax will be taxed for wages up to $137,700. For our case, it will be $137,700*6.2% = $8,537.4

Medicare Tax, according to IRS and the balance, as an employee you need to pay 1.45%, and if you are Single, any income beyond $200,000 will be taxed an extra 0.9%. So we need to pay $150,000 * 1.45% = $2,175

Total FICA Tax is then $8,537.4 + $2,175 = $10,712.4

State Income Tax

Cool, that all we are paying to the federal government, next is state income tax. If you live in income tax free state like Washington, you can skip this part πŸ™‚ (yes I'm extremely jealous).

For California according to FTB, there is another deduction. The more (less) the merrier, right? We take the standard deduction for single $4,601 and we deduct it from AGI $137,600-$4,601=$132,999

According to this table, we have $2581.6+9.30%*($132,999-$58,634)=$9,497.5 of state income tax.

In total, Federal $27,148.5 + FICA $10,712.4 + State $9,497.5=$47,358.4

Effective Tax Rate is then $47,358.4/$150,000=31.6%

Phew, we have finally done all the calculations, but what a pain. To save time for you, I developed a tool for Annual Budget If you fill in your income and expected expenses, it will auto calculate the approximate amount of taxes and how much can you save in the end.
Minwei Xu

Minwei Xu

Software Engineer at Facebook and Indianapolis Real Estate Investor
Bay Area, CA