How the counter works
Enter each stay as a country and two dates: the day you arrived and the day you left. A travel day belongs to both stays, so a stay can begin on the day the previous one ends. The counter then counts the same dates four times, once for each rule, because each rule has its own idea of a day, its own period and its own threshold. Your dates stay in your browser unless you fill in the free guide form.
There is no single 183-day rule. Canada counts 183 days or more in a calendar year. Panama asks for more than 183 days. The US substantial presence test weighs three years of days, and the US physical presence test asks for 330 full days in a foreign country or countries in any 12 consecutive months. HMRC's treaty manual makes the same point about the UK's treaties: some count more than 183 days in the tax year, others in any 12 months. In HMRC's words, "It is important to distinguish between these formulae."
A worked example
A US citizen leaves the US on 3 February 2026 and flies to Panama. They spend 1 to 10 July in Canada, fly home to the US on 8 December, return to Panama on 6 January 2027 and are still there. The "Fill in the worked example" button above enters these dates.
- US physical presence test. The highest count is 335 full days, in the 12 months from 4 February 2026 to 3 February 2027. The arrival day in Panama does not count, and neither do the 30 days from 8 December to 6 January. The calendar year 2026 on its own holds 307 full days, which is why the counter tries every start day and not only 1 January.
- The Canada visit. Panama to Canada and back are moves between foreign countries. A direct flight spends under 24 hours outside any foreign country, so those travel days still count as full days abroad.
- Canada's 183-day rule. 10 days in 2026, arrival and departure days included.
- Panama. 301 days in 2026 counting arrival and departure days, 297 without them. Both readings are above 183, so for 2026 the count does not depend on how Panama treats a travel day.
- US substantial presence test. Not run: the counter runs it only for the status "neither".
How does the physical presence test count days?
The IRS test asks for 330 full days in a foreign country or countries during 12 consecutive months (the physical presence test guide covers the full rule). A full day is 24 consecutive hours from midnight to midnight, so a part day never counts. The IRS example: leave the US on June 10, arrive in France at 9 a.m. on June 11, and the first full day is June 12.
The 12 months can start on any day. They end the day before the same date a year later, so the period holds 365 days, or 366 when it includes 29 February. The IRS lets you choose the 12 months that give the greatest exclusion, and periods can overlap. The counter tries every start day and shows the 12 months with the highest count, plus the highest count for 12 months that include part of each tax year.
Moving between foreign countries keeps the days, unless part of the trip outside any foreign country takes 24 hours or more. In the IRS example a ship leaves Norway at 10 p.m. on July 6 and reaches Portugal at 6 a.m. on July 8, so July 6, 7 and 8 are lost and the next full day is July 9. Time over international waters, in US airspace or changing planes in the US is time outside any foreign country. Enter those hours under "Long travel before this stay?" on the stay that follows.
Days abroad count for any reason, but only while your tax home is in a foreign country. The 330 days are not reduced for illness, family problems, a holiday or an employer's orders. Only the IRS waiver for leaving a country because of war, civil unrest or similar conditions relaxes them. US citizens can use this test or the bona fide residence test; resident aliens can always use this one.
How is the substantial presence test calculated?
The counter runs this test when the status is "neither". It needs at least 31 days in the US in the year, and at least 183 days when you add all the days in the year, one third of the days in the year before and one sixth of the days in the year before that. The IRS example: 120 days in each of three years gives 120 + 40 + 20 = 180 days, under 183. Fractions are not rounded, so a total a fraction below 183 stays below it.
Any part of a day in the US counts, so arrival and departure days both count. For this test the US is the 50 states, the District of Columbia and US territorial waters: not US territories and not US airspace. Some days are left out: regular commuting from a home in Canada or Mexico, transit of under 24 hours between two places outside the US, days as crew of a foreign vessel, days you could not leave because of a medical condition that arose in the US, and days as an exempt individual (some students, teachers and trainees, claimed on Form 8843). Leave those days out of your stays.
When the count reaches the test with fewer than 183 days in the year itself, the closer connection exception may be relevant. It asks for a tax home in one foreign country for the whole year, a closer connection to that country than to the US, and Form 8840 filed on time. The counter flags it and does not decide it.
Does the 183-day rule apply when you leave Canada?
Not as a test of whether you have left. Section 250(1) of the Income Tax Act deems a person resident in Canada for the whole year if they sojourn in Canada for 183 days or more in it, and the CRA counts any part of a day as a day (Folio S5-F1-C1, paragraph 1.33). A deemed resident is taxed on worldwide income for that year.
The rule applies only to people who are not factual residents of Canada. Someone who leaves is judged on residential ties instead: above all a home, a spouse or common-law partner, and dependants. The CRA's folio says that unless a person cuts all significant residential ties on leaving, they continue to be a factual resident taxed on worldwide income, and that even a long temporary absence is usually not enough. Non-residence generally starts on the date the ties are cut. Read how Canada decides tax residency and how to leave Canada, step by step.
How many days make you tax resident in Panama?
Article 762-N of the Código Fiscal (Panama's tax code) sets more than 183 days, in a row or not, in the fiscal year or the year immediately before it. Exactly 183 days is not enough; 184 is. The fiscal year is the calendar year unless a special 12-month period was requested.
A permanent home in Panama is a second ground, whatever the days. The DGI, Panama's tax office, asks first for the days and only then for the home, and the tax tribunal looks at the home together with the centre of economic interests and the centre of family interests: a home alone is not enough. A migration or investment residence permit does not by itself make anyone tax resident. The Panama taxes guide covers how the territorial system treats income.
Panama does not publish how part days, arrival days and departure days count. The counter shows both readings, every day present and every day present except arrival and departure days, and says when the result changes between them.
What the counter does not decide
It counts days under four published rules. It does not decide whether you are resident anywhere, whether you can claim the foreign earned income exclusion, or what you owe. Your tax home, the bona fide residence test, the IRS waiver, the closer connection exception, exempt days, Canada's residential ties, tax treaties and Panama's permanent home ground all sit outside it. Days in US territories such as Puerto Rico have no option in the counter, because they are neither a foreign country for the physical presence test nor the US for the substantial presence test. A tax adviser confirms how each rule applies to you. Borderless Minds takes short applications to talk through a move.
Sources
- IRS: Physical presence test, 26 U.S.C. 911, 26 CFR 1.911-2, exceptions and the waiver and Publication 54.
- IRS: Substantial presence test, Publication 519, 26 CFR 301.7701(b)-1 and the closer connection exception.
- Canada: Income Tax Act, section 250, CRA Income Tax Folio S5-F1-C1 and CRA, Deemed residents of Canada.
- Panama: Tribunal Administrativo Tributario, TAT-RF-013 de 2024 (quoting art. 762-N), Ley 52 de 2012, the Código Fiscal (art. 705), DGI Resolución 201-0354 and the OECD Panama tax residency sheet.
- UK, for the comparison: HMRC DT1921 and HMRC RDR3, Statutory Residence Test.


