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. Click the button below to add your first range.
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 and departure day, which is how most immigration and tax authorities count physical presence. 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
Many countries use 183 days in a calendar year as a common rule of thumb for tax residency, though the exact threshold and what counts as a "day present" vary by country. The United States uses a more detailed substantial presence test: a person must be present at least 31 days in the current year, and the sum of full days in the current year, one-third of the days in the prior year, and one-sixth of the days from two years earlier must reach 183. Countries with tax treaties often add tie-breaker rules, based on where a person keeps a permanent home, where their closest personal and economic ties lie, and where they habitually live, for cases where two countries both claim someone as a resident.
Frequently Asked Questions
How many days make someone a tax resident? 183 days in a calendar year is the most common threshold used worldwide, but it is not universal. Some countries use a lower or higher number, and some 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? Most tax authorities do not count brief transit stops where a traveler never formally enters the country. 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 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
- "Tax residency." OECD. https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-residency/
- "Substantial Presence Test." Internal Revenue Service. https://www.irs.gov/individuals/international-taxpayers/substantial-presence-test
- "Residence status for tax purposes." GOV.UK. https://www.gov.uk/tax-foreign-income/residence