The following is from the FAQ I wrote for, and posted to, the Facebook group ‘American Expats in Portugal’
How Long Can You Leave PT With a Residence Permit?
The table posted by veyorney has been posted in various versions over the years. Some contained errors. The law is the best source for how long you can be outside of Portugal while living there with a Residence Permit.
The D7 visa allows you to enter the country so you can apply for a residence permit. Residence permits have a absence from Portugal restriction. During the valid period of the permit you can be absent from Portugal for 6 months in a row, or 8 months otherwise. So, for a permit with a 2 year valid period, you must stay in Portugal for 16 months (24-8=16) or 18 months (24-6). For a permit with a 3 year valid period, you must stay in Portugal for 28 months (36-8) or 30 months (36-6)
Why Does SEF Limit Absences?
See LEGISPÉDIA SEF - Artigo 85.º – Cancelamento da autorização de residência
The Comments section (not reader’s comments) of Article 85 explains why there there is a limit to absences:
“These prolonged absences indicate that the holder of the authorization no longer resides in the country, maintaining the title of resident for reasons of convenience, due to the facilities that it grants him, namely for the purposes of entry and circulation in the European Union.”
Article 85 - Cancellation of the residence permit
2 - Without prejudice to the application of special provisions, the residence permit may also be canceled when the person concerned, without reasonable reasons, is absent from the country:
a) Being the holder of a temporary residence permit, six consecutive months or eight interpolated months, during the total period of validity of the authorization;
b) Being the holder of a permanent residence permit, 24 consecutive months or, in a period of three years, 30 interpolated months.
3 — Absence beyond the limits provided for in the previous number must be justified by means of a request submitted to the SEF before the resident leaves the national territory or, in exceptional cases, after his/her departure.
According to the law, there are only 2 types of residence permits - temporary and permanent. Temporary ones now have valid periods of 2 or 3 years. See Article 74. Item 2 in the Comments section provides more explanation.
Chrome browser translates Portuguese sites into English (or whatever language you specify)