Residency Calculator: Count Days by Country
This calculator adds up the days spent in each country from a list of date ranges and shows which country has the most days for a chosen calendar year.
Date Ranges
No date ranges added yet. Add your first range below.
Documentation
What Is a Residency Calculator?
A residency calculator adds up the number of days a person spent in each country during a chosen calendar year. It reads a list of date ranges, such as "France, 1 January to 15 March," and totals the days per country. It then reports which country had the most days. Tax residency itself is decided by each country's own laws, not by this tool, but the day counts it produces are the raw input most of those laws start from.
How to Use the Residency Calculator
- Enter the year to check, between 1900 and 2100.
- Add one row for each stay: a start date, an end date, and the country name typed into a text field (there is no country list to pick from).
- Add as many rows as needed for different countries or separate trips.
- The calculator lists the total days per country, flags the country with the most days, and points out any gaps or overlaps in the dates.
Only the part of a stay that falls inside the chosen year is counted. A stay that runs from November 2023 to January 2024 contributes only its January days to a 2024 calculation; the November and December days belong to 2023.
Residency Calculator Formula
For a single stay, the number of days counted is:
1Days = (end date − start date) + 1
2The "+1" counts both the arrival day and the departure day. The US Internal Revenue Service, for example, treats a person as present on any day they are physically in the country at any time during the day. If a stay starts before the chosen year or ends after it, the start or end date used in the formula is trimmed to 1 January or 31 December of that year first.
Days are added up separately for each country. When the same country appears in more than one row, its rows are summed together.
Worked Example
Suppose the chosen year is 2024, a leap year with 366 days, and two stays are entered:
- Portugal: 15 January 2024 to 10 April 2024
- Spain: 15 April 2024 to 31 December 2024
Portugal: 17 days in January (the 15th to the 31st) + 29 days in February + 31 in March + 10 in April = 87 days.
Spain: 16 days in April (the 15th to the 30th) + 245 days from May through December = 261 days.
Spain has more days, so the calculator marks Spain as the suggested country of residence. It also reports two gaps that were never assigned to a country: 1–14 January (14 days) and 11–14 April (4 days). Those two gaps plus the 87 and 261 counted days add up to 366, the full length of the year.
How the Suggested Country Is Chosen
The calculator picks the country with the highest day total and labels it the "suggested country of residence." This is a simple majority rule, not a legal test. It does not check whether any country reached 183 days or any other threshold; it only compares the totals against each other. A country with 90 days out of a total of 200 tracked days can still be marked "suggested" if no other country has more. The label is a starting point for further research, not a legal conclusion.
Overlapping and Missing Date Ranges
The calculator sorts all entered date ranges by start date, then checks each one against the one before it.
- Overlap: if a range starts on or before the previous range's end date, the two ranges describe the same day in two countries at once. The calculator flags this as an error and asks for a correction.
- Missing range: if there is a gap before the first stay, between two stays, or after the last stay (measured against 1 January and 31 December of the chosen year), the calculator lists that gap as unaccounted-for time.
Common Tax Residency Rules Around the World
183 days is a common threshold for tax residency, though the exact rule and what counts as a "day present" vary by country. The United Kingdom, for example, treats a person as resident if they spent 183 or more days in the UK in the tax year, and its tax year runs from 6 April to 5 April. The UK also has other tests based on a home or full-time work.
The United States uses a more detailed substantial presence test. A person must be present at least 31 days in the current year. The days in the current year, plus one-third of the days in the prior year, plus one-sixth of the days from two years earlier, must also add up to 183.
When two countries both treat someone as a resident, a tax treaty between them usually contains tie-breaker rules. The tests are applied in order until one gives an answer: where the person has a permanent home, where their personal and economic ties are closer, where they habitually live, and which country they are a citizen of.
Frequently Asked Questions
How many days make someone a tax resident? 183 days in a year is a common threshold, but it is not universal. Some countries use other rules, and many also weigh factors such as a permanent home or family location.
Does the calculator apply the 183-day rule automatically? No. It only totals the days entered for each country and reports whichever total is largest. Whether that total, or any total, meets a legal residency threshold depends on the rules of the specific country involved.
What happens to a stay that crosses into another year? Only the days that fall inside the selected year are counted. The rest of the stay belongs to whichever year it actually occurred in.
Why does the calculator reject some date entries? Two stays cannot overlap, since a person cannot be physically present in two countries on the same day. Overlapping ranges, along with rows missing a start date, end date, or country name, are flagged or ignored so the totals stay accurate.
Do short airport layovers count as a day in a country? It depends on the country. Under the US substantial presence test, days spent in the United States for less than 24 hours while in transit between two places outside the country do not count. This calculator has no way to detect a layover automatically; only the date ranges entered by the user are counted, so layovers should generally be left out.
Can someone be a tax resident of two countries at once? Yes. This is called dual residency. Tax treaties between the two countries usually include tie-breaker rules to assign a single primary residence for tax purposes.
Limitations
This tool performs simple day counting only. It always counts by calendar year (1 January to 31 December), so its totals do not match countries whose tax year runs on other dates, such as the UK. It does not apply any country's specific tax code, does not weigh prior years the way the US substantial presence test does, and does not consider factors such as permanent homes, family ties, or visa status. Its output is a starting point for record-keeping, not a legal or tax determination. Anyone with a residency question that affects real tax filings should check the rules of the specific countries involved or consult a tax professional.
References
- Internal Revenue Service. Substantial Presence Test. IRS: Substantial Presence Test — the 31-day and 183-day conditions with the 1/3 and 1/6 weighting; days in transit for less than 24 hours do not count.
- Internal Revenue Service. Publication 519, U.S. Tax Guide for Aliens. IRS Publication 519 — a person is present on any day they are physically in the United States at any time during the day.
- GOV.UK. Tax on foreign income: Residence. GOV.UK: Work out your residence status — UK residence if 183 or more days in the UK in the tax year, which runs from 6 April to 5 April.
- HM Revenue & Customs. INTM154020: Double taxation agreements: residence: dual residents. HMRC International Manual INTM154020 — treaty tie-breaker tests: permanent home, centre of vital interests, habitual abode, nationality.