I came to the US in 2016 August as a F1 student and I know I am a non resident alient for the first five years. I want to know when the earliest I can file as a resident alien. Is it when I file in 2021 for 2020 or when I file in 2022 for 2021? Thank you!
In general, the IRS considers status on December 31 to be the one that must be used for filing tax returns for that year. For example, a person who marries during the year (and is still married on December 31 of that year; quickie divorces not allowed!) is entitled to file a joint return with the spouse for that entire year; it is not necessary to file a part-year return as single and a part-year return as married. There are, of course, exceptions to the rule. For example, a person whose spouse passed away during the year and is thus a widow/widower on December 31 ((no quicker remarriages either!) can still file a joint return with the deceased spouse for that year. So, there are two different ways one could look at it but I suspect that the IRS will expect a US resident tax return for all of 2021 (filed in 2022) since the OP will become a tax resident in August 2021. I don't know hat this will do for things like Social Security taxes on any wages for assistantships etc during January 2021-Auugat 2021; these taxes were perhaps not withheld while the OP had F-1 nonresident alien status. Will the OP's W2 for 2021 not include these Jan 2021-Aug 2021 wages in Box 3 "Social Security wages" on the W2 form? Or will all the wages paid in all of 2021 be included in Box 3 while Box 4 "Social Security Tax withheld" shows only the tax withheld during August 2021-December 2021?
You are no longer an "exempt individual" as a student for a given year if you were an "exempt individual" as a student, teacher, or trainee for any part of 5 previous calendar years. For the 2020 tax year, you will have only been an "exempt individual" for some part of 4 calendar years, so you will still be an exempt individual for your days on student status in 2020, and consequently your days that year will not count in the Substantial Presence Test, and you will not pass the Substantial Presence Test for 2020, so you will be a nonresident alien for all of 2020.
But for the 2021 tax year, you will have been an "exempt individual" for some part of 5 calendar years. Even though you came to the US in the middle of 2016, that is still "some part" of 2016 (even one day in 2016 in F1 status counts for one of the 5 years). So you will no longer be an exempt individual for any of your days in student status in 2021, and (assuming you will stay in the US for more than half of 2021), you will pass the Substantial Presence Test for 2021, so you will be a resident alien for all of 2021. You will file your tax return for 2021 in 2022.