Tax Residency Determination Aid

Tax Residency Determination Aid

Based on common international principles (like physical presence and OECD model tie-breakers). Not definitive tax advice.

Country Information

Physical Presence Test (Commonly 183 days)

Inputs Summary:

    `; resultText += `
  • Days in ${countryA}: ${daysInA}
  • `; resultText += `
  • Days in ${countryB}: ${daysInB}
`; resultText += `

Initial Assessment (Based on simplified 183-day presence):

    `; resultText += `
  • Potential resident in ${countryA} based on physical presence? ${residentInA_domestic ? 'Yes' : 'No'}
  • `; resultText += `
  • Potential resident in ${countryB} based on physical presence? ${residentInB_domestic ? 'Yes' : 'No'}
`; let finalResidency = "Undetermined"; let tieBreakerNeeded = false; if (residentInA_domestic && residentInB_domestic) { resultText += `

Potential residency in both ${countryA} and ${countryB} based on physical presence. Tie-breaker rules (based on common treaty principles) may apply.

`; tieBreakerSection.style.display = 'block'; tieBreakerNeeded = true; finalResidency = applyTieBreakers(countryA, countryB); // Apply tie-breakers } else if (residentInA_domestic) { finalResidency = countryA; resultText += `

Potentially resident only in ${countryA} based on physical presence.

`; tieBreakerSection.style.display = 'none'; } else if (residentInB_domestic) { finalResidency = countryB; resultText += `

Potentially resident only in ${countryB} based on physical presence.

`; tieBreakerSection.style.display = 'none'; } else { finalResidency = "Neither (based on this simplified test)"; resultText += `

Potentially resident in neither ${countryA} nor ${countryB} based solely on the simplified 183-day physical presence test. Other tests might apply.

`; tieBreakerSection.style.display = 'none'; } // Add Tie-breaker results if they were applied if (tieBreakerNeeded) { const tieBreakerResultText = getTieBreakerResultText(finalResidency, countryA, countryB); resultText += tieBreakerResultText; } resultText += `

Overall Potential Residency Outcome (Illustrative):

`; if (finalResidency.startsWith('Likely')) { resultText += `

Based on the simplified analysis and common principles, residency is ${finalResidency}.

`; } else if (finalResidency === "Mutual Agreement Needed" || finalResidency === "Tie-Breaker Inconclusive") { resultText += `

The tie-breaker analysis was inconclusive based on the provided information. Residency might be determined by mutual agreement between the countries' tax authorities.

`; } else { resultText += `

Based on the simplified analysis, potential residency appears to be in: ${finalResidency}.

`; } analysisContent.innerHTML = resultText; resultsDiv.style.display = 'block'; } function getSelectedRadioValue(name) { const radios = document.getElementsByName(name); for (let i = 0; i < radios.length; i++) { if (radios[i].checked) { return radios[i].value; } } return null; // Or a default/error value } function applyTieBreakers(countryA, countryB) { const permanentHome = getSelectedRadioValue('permanentHome'); const vitalInterests = getSelectedRadioValue('vitalInterests'); const habitualAbode = getSelectedRadioValue('habitualAbode'); const nationality = getSelectedRadioValue('nationality'); // Store inputs for PDF window.tieBreakerInputs = { permanentHome, vitalInterests, habitualAbode, nationality }; // 1. Permanent Home if (permanentHome === 'A') return `Likely ${countryA} (Permanent Home)`; if (permanentHome === 'B') return `Likely ${countryB} (Permanent Home)`; // 2. Center of Vital Interests (only if home is in both or neither) if (permanentHome === 'Both' || permanentHome === 'Neither') { if (vitalInterests === 'A') return `Likely ${countryA} (Center of Vital Interests)`; if (vitalInterests === 'B') return `Likely ${countryB} (Center of Vital Interests)`; } // 3. Habitual Abode (only if vital interests are unclear or home is in both/neither) if ((permanentHome === 'Both' || permanentHome === 'Neither') && vitalInterests === 'Unclear') { if (habitualAbode === 'A') return `Likely ${countryA} (Habitual Abode)`; if (habitualAbode === 'B') return `Likely ${countryB} (Habitual Abode)`; } // 4. Nationality (only if habitual abode is also indeterminate) if ((permanentHome === 'Both' || permanentHome === 'Neither') && vitalInterests === 'Unclear' && habitualAbode === 'Neither') { if (nationality === 'A') return `Likely ${countryA} (Nationality)`; if (nationality === 'B') return `Likely ${countryB} (Nationality)`; if (nationality === 'Both' || nationality === 'Neither') return "Mutual Agreement Needed"; // Or further steps not covered here } return "Tie-Breaker Inconclusive"; // If logic doesn't resolve } function getTieBreakerResultText(finalResidency, countryA, countryB) { let text = "

Tie-Breaker Analysis (Simplified OECD Model):

    "; const inputs = window.tieBreakerInputs || {}; // Retrieve stored inputs text += `
  • Permanent Home available in: ${inputs.permanentHome === 'A' ? countryA : inputs.permanentHome === 'B' ? countryB : inputs.permanentHome || 'Not specified'}
  • `; if (finalResidency.includes('(Permanent Home)')) { text += `
  • Decision based on Permanent Home.
`; return text; } text += `
  • Center of Vital Interests: ${inputs.vitalInterests === 'A' ? countryA : inputs.vitalInterests === 'B' ? countryB : inputs.vitalInterests || 'Not specified'}
  • `; if (finalResidency.includes('(Center of Vital Interests)')) { text += `
  • Decision based on Center of Vital Interests.
  • `; return text; } text += `
  • Habitual Abode: ${inputs.habitualAbode === 'A' ? countryA : inputs.habitualAbode === 'B' ? countryB : inputs.habitualAbode || 'Not specified'}
  • `; if (finalResidency.includes('(Habitual Abode)')) { text += `
  • Decision based on Habitual Abode.
  • `; return text; } text += `
  • Nationality: ${inputs.nationality === 'A' ? countryA : inputs.nationality === 'B' ? countryB : inputs.nationality || 'Not specified'}
  • `; if (finalResidency.includes('(Nationality)')) { text += `
  • Decision based on Nationality.
  • `; return text; } if (finalResidency === "Mutual Agreement Needed" || finalResidency === "Tie-Breaker Inconclusive") { text += `
  • Result: The tie-breaker rules applied here did not lead to a conclusive determination based on inputs.
  • `; } text += ""; return text; } // --- PDF Download Function --- function downloadPDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); // --- Get Computed Styles for Colors --- const style = getComputedStyle(document.documentElement); const primaryColor = style.getPropertyValue('--primary-color').trim(); const secondaryColor = style.getPropertyValue('--secondary-color').trim(); const accentColor = style.getPropertyValue('--accent-color').trim(); const textColor = style.getPropertyValue('--pdf-body-text').trim(); // Use PDF specific text color const lightTextColor = style.getPropertyValue('--pdf-header-text').trim(); const headerBgColor = style.getPropertyValue('--pdf-header-bg').trim(); const sectionBgColor = style.getPropertyValue('--pdf-section-bg').trim(); // --- PDF Content Generation --- let yPos = 15; // Vertical position tracker const leftMargin = 15; const rightMargin = 195; // Page width (210) - leftMargin const contentWidth = rightMargin - leftMargin; const lineSpacing = 7; const sectionSpacing = 10; // Helper function for adding text with wrapping function addWrappedText(text, x, y, options) { const lines = doc.splitTextToSize(text, contentWidth); doc.text(lines, x, y, options); return y + (lines.length * lineSpacing) - (lineSpacing/2); // Return new Y position } // 1. PDF Header doc.setFillColor(headerBgColor); doc.rect(0, 0, 210, 25, 'F'); // Full width header doc.setFontSize(18); doc.setTextColor(lightTextColor); doc.text("Tax Residency Aid - Results", 105, 15, { align: 'center' }); yPos = 35; // Start below header // --- Get Data --- const countryA = document.getElementById('countryA').value || 'Country A'; const countryB = document.getElementById('countryB').value || 'Country B'; const daysInA = document.getElementById('daysInA').value || 'N/A'; const daysInB = document.getElementById('daysInB').value || 'N/A'; const analysisHTML = document.getElementById('analysisContent').innerHTML; // Simple conversion from HTML result to text for PDF // This is basic; a more robust solution might parse HTML better or rebuild the text let analysisText = analysisHTML.replace(/

    (.*?)<\/strong><\/p>/gi, '\n--- $1 ---\n') // Section titles .replace(/

      /gi, '') .replace(/<\/ul>/gi, '') .replace(/
    • (.*?)<\/li>/gi, '- $1\n') .replace(/(.*?)<\/strong>/gi, '$1') // Bold text .replace(/
      /gi, '\n------------------------------------\n') .replace(/

      (.*?)<\/p>/gi, '$1\n') .replace(//gi, '\n') .replace(/ /g, ' ') .replace(/(\n\s*){2,}/g, '\n\n') // Consolidate multiple newlines .trim(); // 2. Input Summary Section doc.setFontSize(14); doc.setTextColor(sectionBgColor); // Use section color for title yPos = addWrappedText("Input Summary", leftMargin, yPos, {}); yPos += 2; // Small gap doc.setDrawColor(sectionBgColor); doc.line(leftMargin, yPos, rightMargin, yPos); // Separator line yPos += lineSpacing; doc.setFontSize(11); doc.setTextColor(textColor); let inputSummary = `Country A: ${countryA}\nCountry B: ${countryB}\nDays in ${countryA}: ${daysInA}\nDays in ${countryB}: ${daysInB}`; yPos = addWrappedText(inputSummary, leftMargin, yPos, {}); yPos += sectionSpacing; // 3. Analysis Section doc.setFontSize(14); doc.setTextColor(sectionBgColor); yPos = addWrappedText("Potential Residency Analysis", leftMargin, yPos, {}); yPos += 2; doc.setDrawColor(sectionBgColor); doc.line(leftMargin, yPos, rightMargin, yPos); // Separator line yPos += lineSpacing; doc.setFontSize(11); doc.setTextColor(textColor); // Add the extracted analysis text yPos = addWrappedText(analysisText, leftMargin, yPos, {}); yPos += sectionSpacing; // 4. Important Note Section doc.setFontSize(11); doc.setTextColor(accentColor); // Use accent color for the note title yPos = addWrappedText("Important Note:", leftMargin, yPos, {}); yPos += 2; doc.setTextColor(textColor); // Regular text color for the note body const noteText = "This tool provides a simplified analysis based on common international principles and the information provided. Tax residency rules are complex and vary significantly by country. This is NOT definitive legal or tax advice. Always consult a qualified tax professional in the relevant jurisdictions for accurate guidance."; yPos = addWrappedText(noteText, leftMargin, yPos, { FontStyle: 'italic' }); // Italicize note // --- Save PDF --- doc.save(`Tax_Residency_Aid_${countryA}_${countryB}.pdf`); }

    The Tax Residency Determination Aid is an essential tool designed to help individuals, expatriates, and tax professionals determine tax residency status accurately. Tax residency affects how and where you are taxed and influences your filing requirements, deductions, and tax treaty benefits.

    This aid guides you through key residency tests such as the substantial presence test, domicile rules, and statutory residency criteria used by various countries. By entering relevant information about your time spent in different jurisdictions, ties to countries, and other factors, you can clarify your residency status.

    Understanding your tax residency is crucial for compliance with local tax laws and avoiding double taxation. It also helps in planning your finances, investments, and international income reporting. The tool highlights common residency scenarios and explains how tax treaties may impact your status.

    The Tax Residency Determination Aid simplifies complex rules into an easy-to-follow process, making it accessible for individuals and professionals alike. It supports informed decision-making related to international moves, work assignments, and cross-border financial activities.

    Whether you are an expat, remote worker, or tax advisor, this tool provides reliable insights to manage your tax residency confidently and accurately.

    Start using the Tax Residency Determination Aid today to clarify your tax residency and ensure compliance with applicable tax laws.

    Scroll to Top