Packed Encoding Rules

The Packed Encoding Rules (PER) are the most compact encoding rules. The goal of PER is to create smaller encodings. An advantage of using PER is the way it encodes data by examining constraints.

PER differs from BER in that PER does not send the Tag of the TLV since the order in which components of the message occur is known. PER also does not send the Length of the TLV if the Value has a fixed length. PER also uses additional information from the ASN.1 message description to eliminate redundant information from the Value portion of the TLV, thus making PER messages quite compact and suitable for environments in which bandwidth conservation is important.

There are four variants of PER:

  • Bit-aligned non-canonical (unaligned PER)
  • Bit-aligned canonical encoding
  • Octet-aligned non-canonical (aligned PER)
  • Octet-aligned canonical encoding


Age ::= INTEGER (0..7)
firstGrade Age ::= 6
        -- C0

In the following example, integer A has four possible states, and you only need two bits to represent all possible states. Since we need two bits, there's no need to encode a length; it will always be two bits:

A ::= INTEGER (1234567..1234570)
a A ::= 1234568 -- encoded in 2 bits

On the other hand, B in the example below is unbounded and therefore has an infinite number of states. Since we cannot know its length in advance, we must have a length field. The length field takes 8 bits and the value field takes 24 bits.

b B ::= 1234568 -- encoded in 32 bits
                -- 8 bit length + 24 bit value

Related Topics