Area code (DDD)

Telephone area codes (DDD) in use under the Anatel Plano Geral de Numeração, and the states they serve.

  • Parity matrix

Decode

Returns the state and region that a DDD (area code) belongs to, among the 67 DDDs in use under the Anatel Plano Geral de Numeração.

  • areaCode may be a string or a non-negative integer.
  • A string has every character that is not a digit removed first, as in 2.4.0: "(0xx11)" and " 11 " resolve to 11.
  • The result carries the DDD, the state it is seated in (code and name), its region (code and name) and every state it serves.
  • The seat is the state of the city the code was allocated around, not necessarily the state with most of its municipalities: DDD 61 is seated in DF, which holds only 1 of its 13 municipalities (Brasília).
  • Four DDDs straddle a state border (61, 42, 47 and 49). For these, the list of states also has the other state, with the seat first: 61 gives DF, GO, 42 gives PR, SC, 47 and 49 give SC, PR.
  • Returns null for a DDD not in use, a negative or non-integer number, or anything else.
ParameterTypeRequired
areaCodestring | numberyes
returnsAreaCodeInfo | null

Get the state and region a Brazilian DDD (area code) belongs to, out of the 67 DDDs in use under the Anatel Plano Geral de Numeração. Accepts a string or a non-negative integer.

  • A string has any non-digit characters stripped, so '(11)', '0xx11' and 'DDD 11' are the DDD 11.
  • Returns an AreaCodeInfo: areaCode, stateCode, stateName, regionCode, regionName and stateCodes. Returns null when the DDD is not in use.
  • stateCode is the state the DDD is seated in. For the four DDDs that straddle a border (61, 42, 47 and 49) stateCodes also lists the other state, the seat first.
import { getAreaCodeInfo } from '@brazilian-utils/brazilian-utils';

getAreaCodeInfo('11');
// { areaCode: 11, stateCode: 'SP', stateName: 'São Paulo', regionCode: 'SE', regionName: 'Sudeste', stateCodes: ['SP'] }

getAreaCodeInfo(21);
// { areaCode: 21, stateCode: 'RJ', stateName: 'Rio de Janeiro', regionCode: 'SE', regionName: 'Sudeste', stateCodes: ['RJ'] }

getAreaCodeInfo('61');
// { areaCode: 61, stateCode: 'DF', stateName: 'Distrito Federal', regionCode: 'CO', regionName: 'Centro-Oeste', stateCodes: ['DF', 'GO'] }

getAreaCodeInfo('00'); // null
getAreaCodeInfo('(0xx11)'); // the same as '11'
getAreaCodeInfo(-11); // null
getAreaCodeInfo(1.1); // null

Source: Resolução Anatel nº 749/2022, Anatel Códigos Nacionais, Anatel table of the Códigos Nacionais by municipality (21/09/2026).

Code: brazilian-utils/javascript
Try it with JavaScript getAreaCodeInfo
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (13) and the result in each library areaCode.getInfo

Get by municipality code

Returns the DDD (area code, the Código Nacional of the Plano Geral de Numeração) that a municipality dials, given its 7-digit IBGE code.

  • code is read as municipality.getByCode reads it: a string with every non-digit removed, or a non-negative integer.
  • Each of the 5,571 municipalities has exactly one DDD, so null only means that the code is not a municipality.
  • A DDD mostly follows state lines. The exceptions: 61, the DDD of Brasília, also covers 12 municipalities of Goiás. Porto União (SC) dials 42, Rio Negro (PR) dials 47 and Barracão (PR) dials 49.
  • areaCode.getInfo gives the state and region the DDD is seated in.
  • The table comes from the Anatel Códigos Nacionais file of 21/09/2026, rows in force only.
ParameterTypeRequired
codestring | numberyes
returnsnumber | null

Get the DDD (area code) a Brazilian municipality dials, given its 7-digit IBGE code, from the Anatel table of the Códigos Nacionais in force.

  • Accepts the code the way getMunicipalityByCode does: a string (any non-digit characters stripped) or a non-negative integer.
  • Returns the DDD as a number, or null when the code is not a municipality. Every one of the 5,571 municipalities has exactly one DDD.
  • A DDD mostly follows state lines. The exceptions: 61 also covers 12 municipalities of Goiás around Brasília, and Porto União (SC) dials 42, Rio Negro (PR) 47 and Barracão (PR) 49.
import { getAreaCodeByMunicipalityCode } from '@brazilian-utils/brazilian-utils';

getAreaCodeByMunicipalityCode('3550308'); // 11 (São Paulo/SP)
getAreaCodeByMunicipalityCode(3304557); // 21 (Rio de Janeiro/RJ)
getAreaCodeByMunicipalityCode('4122305'); // 47 (Rio Negro/PR)
getAreaCodeByMunicipalityCode('0000000'); // null

Source: Resolução Anatel nº 749/2022, Anatel Códigos Nacionais, Anatel table of the Códigos Nacionais by municipality (21/09/2026).

Code: brazilian-utils/javascript
Try it with JavaScript getAreaCodeByMunicipalityCode
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (21) and the result in each library areaCode.getByMunicipalityCode

List by state

Returns every DDD (area code) that serves a state, sorted in ascending order.

  • stateCode is matched ignoring case and surrounding whitespace, as it already was in 2.4.0.
  • A DDD that straddles a border is listed under every state it serves.
  • Returns an empty list when stateCode is not a Brazilian state.
ParameterTypeRequired
stateCodestringyes
returnsnumber[]

Get every DDD (area code) that serves a given Brazilian state, under the Anatel Plano Geral de Numeração. The match is case-insensitive and the result is sorted in ascending order.

  • Returns [] when stateCode does not match a Brazilian state.
  • A DDD that straddles a border (the same four as getAreaCodeInfo) is listed under every state it serves.
import { getAreaCodesByState } from '@brazilian-utils/brazilian-utils';

getAreaCodesByState('SP'); // [11, 12, 13, 14, 15, 16, 17, 18, 19]
getAreaCodesByState('ac'); // [68]
getAreaCodesByState('DF'); // [61]
getAreaCodesByState('GO'); // [61, 62, 64]
getAreaCodesByState('SC'); // [42, 47, 48, 49]
getAreaCodesByState('XX'); // []

Source: Resolução Anatel nº 749/2022, Anatel Códigos Nacionais, Anatel table of the Códigos Nacionais by municipality (21/09/2026).

Code: brazilian-utils/javascript
Try it with JavaScript getAreaCodesByState
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (14) and the result in each library areaCode.listByState

Official sources

See also Phone, States (UF), Municipalities

Last updated on

On this page