Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Binary, Decimal, and Hexadecimal Numeral Systems | Blocks and Transactions
course content

Course Content

Introduction to Blockchain

Binary, Decimal, and Hexadecimal Numeral SystemsBinary, Decimal, and Hexadecimal Numeral Systems

In the realm of blockchain and computing, understanding numeral systems is fundamental, mainly binary, decimal, and hexadecimal.

If you want to delve deeper into numeral systems, you can take our Numeral Systems 101 course.

Decimal System

The decimal system, or base-10 system, is our everyday system of counting and uses ten digits, 0 through 9. While not used directly in the mechanics of the blockchain, it is the system we use to interpret values.

Binary System

The binary system, or base-2 system, is the core language of computers, representing values using two digits: 0 and 1. Each digit in binary is called a bit, the basic unit of information. Number 4 in binary, for instance, is 100.

However, in computer memory, the number of bits required for an integer has to be chosen in advance. Suppose we want 8 bits (1 byte) for an integer meaning that the integer must always take up eight digits regardless whether it uses all of them. Number 4 will be represented as follows: 00000100.

Let's take a look at the decimal numbers from 0 to 4 represented as 8-bit (1-byte) integers in binary:

Base 10 Base 2
0 00000000
1 00000001
2 00000010
3 00000011
4 00000100

Hexadecimal System

Hexadecimal system, or base-16 system, extends the decimal system to sixteen symbols: 0 to 9 followed by a to f (a = 10, b = 11, ..., f = 15). Moreover, hexadecimal numbers are often prefixed with the 0x characters. In computing, hexadecimal provides a more human-friendly representation of binary-coded values.

It's compact and easier to understand at a glance than binary, especially for large numbers. Bitcoin's block headers, for example, are stored in hexadecimal, however, processed in binary.

Let's extend the table above with hexadecimal representations of 1-byte integers from 0 to 15:

Base 10 Base 2 Base 16
0 0b00000000 0x00
1 0b00000001 0x01
2 0b00000010 0x02
3 0b00000011 0x03
4 0b00000100 0x04
5 0b00000101 0x05
6 0b00000110 0x06
7 0b00000111 0x07
8 0b00001000 0x08
9 0b00001001 0x09
10 0b00001010 0x0A
11 0b00001011 0x0B
12 0b00001100 0x0C
13 0b00001101 0x0D
14 0b00001110 0x0E
15 0b00001111 0x0F

Similarly to hexadecimal numbers, binary numbers are also sometimes prefixed with the 0b characters.

Two hexadecimal characters represent 1 byte (8 bits).

Binary/Decimal Conversion

To convert binary to decimal, multiply each bit by 2 raised to the power of its position from right to left, starting with 0, and sum the results. Here is an example:

Binary to decimal

Binary: 1101
Decimal: 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0 = 8 + 4 + 0 + 1 = 13

To convert decimal to binary, divide the number by 2 and write down the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. The binary number is the remainders read in reverse order.

Let's take a look at an example:

Decimal to binary

Decimal: 13
Binary: 1101 (13 divided by 2 is 6 remainder 1, 6 divided by 2 is 3 remainder 0, 3 divided by 2 is 1 remainder 1, and 1 divided by 2 is 0 remainder 1)

Hexadecimal/Decimal Conversion

To convert hexadecimal to decimal, convert each hexadecimal digit to a decimal number and then, similarly to binary, multiply each converted digit by 16 raised to the power of its position from right to left, starting with 0, and sum the results.

Hexadecimal to decimal

Hexadecimal: 1A3
Decimal: 1*16^2 + 10*16^1 + 3*16^0 = 256 + 160 + 3 = 419

To convert decimal to hexadecimal, divide the number by 16 and write down the remainder. Continue dividing the quotient by 16 until you get a quotient of zero. The hexadecimal number is the remainders read in reverse order.

Decimal to hexadecimal

Decimal: 419
Hexadecimal: 1A3 (419 divided by 16 is 26 remainder 3, and 26 divided by 16 is 1 remainder 10, which is 'A' in hex)

Binary/Hexadecimal Conversion

In order to convert binary to hexadecimal or vice versa, you can first convert to decimal, then convert from decimal to the respective numeral system.

question-icon
Write down the correct representations of given numbers in different numeral systems. Do NOT use the 0x prefix for hexadecimal numbers and 0b prefix for decimal numbers.

25 (decimal) in binary:

382 (decimal) in hexadecimal:


110010 (binary) in decimal:


CA (hexadecimal) in decimal:

Everything was clear?

Section 2. Chapter 2
course content

Course Content

Introduction to Blockchain

Binary, Decimal, and Hexadecimal Numeral SystemsBinary, Decimal, and Hexadecimal Numeral Systems

In the realm of blockchain and computing, understanding numeral systems is fundamental, mainly binary, decimal, and hexadecimal.

If you want to delve deeper into numeral systems, you can take our Numeral Systems 101 course.

Decimal System

The decimal system, or base-10 system, is our everyday system of counting and uses ten digits, 0 through 9. While not used directly in the mechanics of the blockchain, it is the system we use to interpret values.

Binary System

The binary system, or base-2 system, is the core language of computers, representing values using two digits: 0 and 1. Each digit in binary is called a bit, the basic unit of information. Number 4 in binary, for instance, is 100.

However, in computer memory, the number of bits required for an integer has to be chosen in advance. Suppose we want 8 bits (1 byte) for an integer meaning that the integer must always take up eight digits regardless whether it uses all of them. Number 4 will be represented as follows: 00000100.

Let's take a look at the decimal numbers from 0 to 4 represented as 8-bit (1-byte) integers in binary:

Base 10 Base 2
0 00000000
1 00000001
2 00000010
3 00000011
4 00000100

Hexadecimal System

Hexadecimal system, or base-16 system, extends the decimal system to sixteen symbols: 0 to 9 followed by a to f (a = 10, b = 11, ..., f = 15). Moreover, hexadecimal numbers are often prefixed with the 0x characters. In computing, hexadecimal provides a more human-friendly representation of binary-coded values.

It's compact and easier to understand at a glance than binary, especially for large numbers. Bitcoin's block headers, for example, are stored in hexadecimal, however, processed in binary.

Let's extend the table above with hexadecimal representations of 1-byte integers from 0 to 15:

Base 10 Base 2 Base 16
0 0b00000000 0x00
1 0b00000001 0x01
2 0b00000010 0x02
3 0b00000011 0x03
4 0b00000100 0x04
5 0b00000101 0x05
6 0b00000110 0x06
7 0b00000111 0x07
8 0b00001000 0x08
9 0b00001001 0x09
10 0b00001010 0x0A
11 0b00001011 0x0B
12 0b00001100 0x0C
13 0b00001101 0x0D
14 0b00001110 0x0E
15 0b00001111 0x0F

Similarly to hexadecimal numbers, binary numbers are also sometimes prefixed with the 0b characters.

Two hexadecimal characters represent 1 byte (8 bits).

Binary/Decimal Conversion

To convert binary to decimal, multiply each bit by 2 raised to the power of its position from right to left, starting with 0, and sum the results. Here is an example:

Binary to decimal

Binary: 1101
Decimal: 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0 = 8 + 4 + 0 + 1 = 13

To convert decimal to binary, divide the number by 2 and write down the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. The binary number is the remainders read in reverse order.

Let's take a look at an example:

Decimal to binary

Decimal: 13
Binary: 1101 (13 divided by 2 is 6 remainder 1, 6 divided by 2 is 3 remainder 0, 3 divided by 2 is 1 remainder 1, and 1 divided by 2 is 0 remainder 1)

Hexadecimal/Decimal Conversion

To convert hexadecimal to decimal, convert each hexadecimal digit to a decimal number and then, similarly to binary, multiply each converted digit by 16 raised to the power of its position from right to left, starting with 0, and sum the results.

Hexadecimal to decimal

Hexadecimal: 1A3
Decimal: 1*16^2 + 10*16^1 + 3*16^0 = 256 + 160 + 3 = 419

To convert decimal to hexadecimal, divide the number by 16 and write down the remainder. Continue dividing the quotient by 16 until you get a quotient of zero. The hexadecimal number is the remainders read in reverse order.

Decimal to hexadecimal

Decimal: 419
Hexadecimal: 1A3 (419 divided by 16 is 26 remainder 3, and 26 divided by 16 is 1 remainder 10, which is 'A' in hex)

Binary/Hexadecimal Conversion

In order to convert binary to hexadecimal or vice versa, you can first convert to decimal, then convert from decimal to the respective numeral system.

question-icon
Write down the correct representations of given numbers in different numeral systems. Do NOT use the 0x prefix for hexadecimal numbers and 0b prefix for decimal numbers.

25 (decimal) in binary:

382 (decimal) in hexadecimal:


110010 (binary) in decimal:


CA (hexadecimal) in decimal:

Everything was clear?

Section 2. Chapter 2
some-alt