CBO

Classificação Brasileira de Ocupações: the occupation codes of the current CBO 2002 release of the MTE.

  • Parity matrix

Validate

Checks whether a CBO code exists in the official CBO 2002 occupation table.

  • Accepts the 6 digits, the NNNN-NN mask or a non-negative integer. A masked string may have any run of separators (space, ., - or /) between the groups: 2124--05 is valid. Until 2.4.0 the mask had a single separator and 2124--05 was rejected.
  • Separators are accepted only at the boundary between the groups: 2124-0-5 and 21-2405 are invalid. Surrounding whitespace is ignored.
  • Bare digits (string or number) are left-padded with zeros to 6. A masked value is read as written.
  • Any other string is rejected. The function does not pick out its digits.
  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number is invalid.
  • The table follows the current release of the MTE, the "Estrutura CBO (CSV)" files of 10/07/2026 with 2,725 occupations. 2.4.0 used the older gov.br CSV of 06/06/2025 (2,694 occupations).
  • A code the MTE retired is no longer valid. 225142, 322105, 322115, 322120, 322125 and 782820 were valid in 2.4.0 and are invalid now. Some moved to new codes: Técnico em acupuntura is now 322705.
  • 37 occupations were added, among them 782325 (Motorista de transporte por aplicativos), 142360 and 225157.
ParameterTypeRequired
valuestring | numberyes
returnsboolean

Check if a CBO (Classificação Brasileira de Ocupações) code exists in the official CBO 2002 table.

  • Accepts a string with the 6 digits or with the NNNN-NN mask, or a number.
  • A masked string may have any run of separators (space, ., - or /) between the groups. Any other string is rejected instead of having its digits picked out.
  • Bare digits are left padded with zeros to 6, as a string or as a number. A masked value is read as written.
import { isValidCbo } from '@brazilian-utils/brazilian-utils';

isValidCbo('2124-05'); // true
isValidCbo('212405'); // true
isValidCbo(212405); // true
isValidCbo(10205); // true (padded to 6 digits, so this is '010205')
isValidCbo('10205'); // true (padded the same way a number is)
isValidCbo('000000'); // false
isValidCbo('2124abc05'); // false (not a documented form)
isValidCbo(-212405); // false (not a non-negative safe integer)

Source: CBO 2002 tables published by the MTE ("Estrutura CBO (CSV)", files of 10/07/2026, 2,725 occupations).

Code: brazilian-utils/javascript
Try it with JavaScript isValidCbo
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 (38) and the result in each library cbo.isValid

Format

Formats a CBO code with the mask NNNN-NN. Only the structure changes (use cbo.isValid to check the code against the table).

  • The mask is applied as far as the digits go, which is what an input being typed into needs.
  • options.pad (default false) first left-pads the value with zeros to 6 digits. A number is treated as the string of its digits, so it is padded only with pad.
  • A string is read for its digits: other characters are dropped and digits after the last one of the mask are ignored.
  • Returns an empty string when there is no digit at all, also with pad. null and undefined return an empty string too.
  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string.
  • New in 2.5.0 (#615), so every masked classification code has its formatter.
ParameterTypeRequired
valuestring | numberyes
optionsFormatCboOptionsno
options.padbooleanno
returnsstring

Format a CBO (Classificação Brasileira de Ocupações) code into the NNNN-NN mask. Only the structure changes; use isValidCbo to check a code against the table.

  • Options (FormatCboOptions): pad (default false) first left pads the value with zeros to the 6 digits of a complete code. Without it the mask is applied as far as the value goes. An empty value, or one without digits, gives '' even with pad.
  • Characters outside the mask are dropped, and a number is read as the string of its digits only when it is a non-negative safe integer: a negative, fractional or unsafe number returns ''. Returns '' when there is no digit at all.
import { formatCbo } from '@brazilian-utils/brazilian-utils';

formatCbo('212405'); // 2124-05
formatCbo('21240'); // 2124-0 (masked as far as it goes)
formatCbo('10205', { pad: true }); // 0102-05 (padded to 6 digits first)
formatCbo('abc212405'); // 2124-05 (only the digits are read)
formatCbo(-212405); // '' (not a non-negative safe integer)

Source: CBO 2002 tables published by the MTE, which print the codes as NNNN-NN.

Code: brazilian-utils/javascript
Try it with JavaScript formatCbo
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 (26) and the result in each library cbo.format

Parse

Removes CBO formatting and keeps only digits, capped at 6 digits.

  • It does not left-pad anything. A leading zero must be written out.
  • Returns an empty string when there is no digit at all (null and undefined included).
  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string (2.4.0 read the digits of any number, sign and decimal point dropped).
ParameterTypeRequired
valuestring | numberyes
returnsstring

Remove CBO (Classificação Brasileira de Ocupações) formatting, keep only digits, and cap the result to 6 digits.

  • Nothing is left padded: the leading zero of a code such as 010205 has to be written out. Use getCbo or isValidCbo to look an occupation up.
import { parseCbo } from '@brazilian-utils/brazilian-utils';

parseCbo('2124-05'); // '212405'
Code: brazilian-utils/javascript
Try it with JavaScript parseCbo
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 (10) and the result in each library cbo.parse

Look up

Looks up a CBO code in the CBO 2002 occupation table and returns its code and official title (description).

  • Same input rules as cbo.isValid. The returned code is the 6 bare digits.
  • Returns null for an unknown code or a value not written in one of the accepted forms. A run of separators between the groups is accepted, as in cbo.isValid (2124--05 gives the entry; until 2.4.0 it gave null).
  • It returns null exactly when cbo.isValid returns false. The table and its titles follow the current MTE release (10/07/2026). 106 titles changed from 2.4.0, and codes the MTE retired return null.
ParameterTypeRequired
valuestring | numberyes
returnsCbo | null

Look a CBO (Classificação Brasileira de Ocupações) code up and get its official occupation title. The result is a Cbo record: { code, description }.

  • Same rules as isValidCbo. Returns null when the code is unknown or the value is not in a documented form.
import { getCbo } from '@brazilian-utils/brazilian-utils';

getCbo('2124-05'); // { code: '212405', description: 'Analista de desenvolvimento de sistemas' }
getCbo(10205); // { code: '010205', description: 'Oficial da aeronáutica' } (padded to 6 digits)
getCbo('10205'); // { code: '010205', description: 'Oficial da aeronáutica' } (padded the same way)
getCbo('000000'); // null
getCbo('2124abc05'); // null (not a documented form)

Source: CBO 2002 tables published by the MTE ("Estrutura CBO (CSV)", files of 10/07/2026, 2,725 occupations).

Code: brazilian-utils/javascript
Try it with JavaScript getCbo
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 (30) and the result in each library cbo.get

Official sources

Last updated on

On this page