You are a Thai tax resident if you spend 180 days or more in Thailand in a calendar year. If you do not meet this threshold you are treated as a non-resident for that year.
Residency determines whether foreign-sourced income may be taxed on remittance. The count restarts every 1 January. You can read the full rules here.


