# Encodings overview

Reading a number from a card isn't possible without knowing its encoding. The reason is that one and the same number can be understood in many different ways - and only the encoding can tell you which meaning is intended:

To spare you as many details as possible, we've created a step-by-step guide to help you find out the encoding of your project cards. However, if you'd like to dive deeper into this topic, then please read on here.

We explain the following terms the way we use them at BALTECH. They may have different meanings in different contexts.

## What is encoding?

All data is ultimately a sequence of zeros and ones. Encoding assigns a specific character (e.g. a number) to such a sequence, thus making it actually readable. There are various different ways to encode data. The ones relevant in our context are the following:

## Binary

Binary encoding groups the digits (referred to as "bits") to blocks of 8 (referred to as "bytes"). Such a byte can have a total of 256 possible combinations and can thus represent a wide variety of different characters.

The actual meaning, i.e. the number behind it, depends on the order in which the bits are read.

### MSB first

MSB first stands for Most Significant Bit first. This means that the bytes are read in the order they appear, i.e. from left to right. In the example above, this produces the decimal number 12594.

### LSB first

LSB first stands for
Least Significant Bit first.
With this option, you get a **mirror reflection of the bytes**: The order of bytes is reversed, i.e the last byte is read first.
In the example above, this produces the decimal number 12849.

Rotate Bytewise

To cater for this reversed order, there's the *Rotate Bytewise* option
in the RFID interface component.

## ASCII

ASCII stands for American Standard Code for Information Interchange and is another way of assigning characters to bytes. Here, a character is defined by 7 bits, which allows for the representation of 128 different characters. The remaining bit is the "parity bit" used for error checking. (Nowadays it can also be used to allow ASCII to represent additional characters. This is known as extended ASCII.)

The actual meaning of an ASCII bit sequence depends on whether it's represented as a decimal or hexadecimal number.

This is the encoding you see when you test the RFID interface in BALTECH ID-engine Explorer (learn more).

### Decimal (DEC)

Decimals are the representation we use in everyday life. Here we can use the 10 characters 0-9 to represent any number.

### Hexadecimal (HEX)

In contrast to decimal, hexadecimal uses 16 characters: not only 0-9, but also the letters A-F that represent the decimal numbers 10-15. These additional characters make the hexadecimal representation more efficient than decimal as 6 more numbers can be represented with just 1 digit. When 2 digits are available, the difference is even more striking: Here, hexadecimal can represent 256 numbers, whereas decimal can only represent 100.

## BCD

BCD stands for Binary-Coded Decimal, i.e. it's yet another way of encoding a decimal number. Here, each digit of the decimal number is stored in a 4-bit sequence referred to as "nibble", i.e. 2 digits are represented per byte.

We hope this very basic overview has given you an idea of how encoding influences what number you eventually get from a card. That's why it's so important to "tell" the reader which encoding to use when configuring the RFID interface. To identify the encoding of your project cards, you can follow our step-by-step guide.