Convert hexadecimal number to binary online. Converting numbers from one number system to another online


Many computer users understand that the computer operates in binary system Reckoning. Traditionally, the states of a binary system are represented by the numbers 0 and 1, although, more precisely, each state indicates the presence or absence of a signal, i.e. it would be more correct to call the states “off” and “on”, or “no” and “yes”. The state “off” or “no” corresponds to the number 0, and the state “on” or “yes” corresponds to the number 1. For ordinary users Usually there is no need to fully understand the structure of the computer, but the binary number system makes itself felt in the form of various restrictions based on powers of two. A more compact version of the binary system is called hexadecimal. The number sixteen is the fourth power of two. It follows from this that you can quite simply convert long binary sequences of zeros and ones into short hexadecimal ones. To do this, simply split the binary sequence into groups of four digits (digits) starting with the least significant digit (on the right) and replace each group with the corresponding hexadecimal value.

It is customary to use the hexadecimal system for ease of perception of binary data, since translations from hexadecimal system to binary and back are carried out by simply replacing strings. The computer works exclusively with binary sequences, and the hexadecimal notation of this sequence is four times more compact, since this system has base 16 (2 16), and binary 2. The binary sequence can be quite cumbersome. For example, writing the number 513 requires ten binary digits (1000000001), but only three in hexadecimal (201). However, sixteen is required to represent any hexadecimal numbers different characters, and not ten, which are used in the decimal number system familiar to us. The first ten characters are characters in the range from 0 to 9, the rest are letters of the Latin alphabet in the range from A to F. The letters are usually (but not always) written in uppercase (capital) in hexadecimal notation of the number. The first ten characters (from 0 to 9) are written similarly to numbers in the decimal number system and correspond to them. Letters in the range A through F correspond to values ​​in the range 10 to 15.

Let's consider the correspondence of numbers from 0 to 15 in hexadecimal and binary number systems.

Decimal notation Hexadecimal notation Binary notation
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111

The entries for 10, 11, etc. in decimal, binary, and hexadecimal systems do not correspond to each other. Let's look at a small example. Let us have a hexadecimal number 1A5E. To convert to binary, simply replace the hexadecimal digits with the corresponding binary groups. The result is 0001 1010 0101 1110. If we remove the insignificant zeros in front of the number and write it without separators, we get 1101001011110. For the reverse translation, we divide the number into groups of four digits, starting with the least significant (on the right side), and also for convenience we add insignificant zeros to senior group up to 4 digits. We get 0001 1010 0101 1110. Replace the groups with the corresponding ones hexadecimal values, we get 1A5E.

For translate hexadecimal number In decimal representation, you can use the scheme by which we write decimal numbers. In a decimal number, each digit represents the corresponding power of ten, starting from zero and increasing from right to left. For example, decimal number 123 means 1*10 2 + 2*10 1 + 3*10 0 . Using a similar method, we convert the number 1A5E to decimal system Reckoning. In the hexadecimal number system, as well as in the decimal number system, each digit denotes the corresponding power of the number sixteen, starting from zero and increasing from right to left. The characters 1 and 5 in hexadecimal correspond to the values ​​1 and 5 in decimal, and the characters A and E correspond to 10 and 14. Then 1A5E can be represented in decimal as 1*16 3 + 10*16 2 + 5*16 1 + 14*16 0 = 6750. However, to evaluate hexadecimal numbers it is not at all necessary to convert them to decimal. The rules for comparison, addition and multiplication in this system are the same as in the decimal system, the main thing is not to forget that each digit can contain values ​​from 0 to 15. For more quick translation number between the number system can be used standard calculator in Windows, to do this, just select the number system in the advanced mode of the calculator, enter a number in it and select the right system number in which the result should be displayed.

Because numeric-only hexadecimal numbers are easily confused with decimal numbers, they are usually marked in a way that makes it clear that hexadecimal notation is used. Hexadecimal entries are usually marked by either appending lowercase letter“h”, or the prefix “0x” before writing the number. Thus, the hexadecimal number 1A5E can be written as 1A5Eh or 0x1A5E, where a trailing “h” or a leading “0x” indicates that hexadecimal notation is used.

Originated in ancient Babylon. In India, the system works in the form of positional decimal numbering using zero, among Hindus this system numbers were borrowed by the Arab nation, and the Europeans, in turn, took them from them. In Europe, this system began to be called Arabic.

Positional systemdead reckoning— the meaning of all digits depends on the position (digit) of the given digit in the number.

Examples, the standard decimal number system is a positional system. Let's say given a number453 . Number 4 stands for hundreds and corresponds to a number400, 5 - number of tens and corresponds to the value50 , A 3 - units and meaning3 . It is easy to see that as the digit increases, the value increases. Thus, we write the given number as a sum400+50+3=453.

Hexadecimal number system.

Hexadecimal number system(hexadecimal numbers) - positional number system. Hexadecimal base is the number 16.

Writing numbers in octal number system we get quite compact expressions, but in hexadecimal we get more compact expressions.

The first ten digits of the sixteen hexadecimal digits are the standard spacing 0 - 9 , the next six digits are expressed using the first letters of the Latin alphabet: A, B, C, D, E, F. Convert from hexadecimal to binary and reverse side do the same process for the octal system.

Application of the hexadecimal number system.

The hexadecimal number system is used quite well in modern computers, For example use it to indicate color: #FFFFFF- White color.

Converting numbers from one number system to another.

Converting numbers from hexadecimal to decimal.

To convert a hexadecimal number to decimal, you need to reduce the given number to the form of the sum of the products of the powers of the base of the hexadecimal number system by the corresponding digits in the digits of the hexadecimal number.

For example, convert the hexadecimal number 5A3 to decimal. Here 3 numbers. Based on the above rule, we reduce it to the form of a sum of powers with a base of 16:

5A3 16 = 3·16 0 +10·16 1 +5·16 2 = 3·1+10·16+5·256 = 3+160+1280 = 1443 10

Converting numbers from binary to hexadecimal and vice versa.

To convert a multi-digit binary number to hexadecimal, you need to divide it into tetrads from right to left and replace all tetrads with the corresponding hexadecimal digit. To convert a number from the hexadecimal system to the binary system, you need to change each digit to the corresponding tetrads from the conversion table, which you will find below.

For example:

010110100011 2 = 0101 1010 0011 = 5A3 16

Number conversion table.

An algorithm for converting numbers from one number system to another.

1. From the decimal number system:

  • divide the number by the base of the translated number system;
  • find the remainder when dividing the integer part of a number;
  • write down all remainders from division in reverse order;

2. From the binary number system:

  • to convert to the decimal number system, we find the sum of the products of base 2 by the corresponding degree of digit;
  • To convert a number to octal, we divide the number into triads.

For example, 1000110 = 1,000,110 = 1068

  • To convert a number from the binary number system to hexadecimal, we divide the number into groups of 4 digits.

For example, 1000110 = 100 0110 = 4616.

Translation tables:

Binary SS

Hexadecimal SS

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

Binary SS

To represent numbers in a microprocessor it is used binary number system.
Moreover, any digital signal can have two stable states: " high level" And " low level" In the binary number system, any number is represented by two digits, respectively: 0 and 1. Arbitrary number x=a n a n-1 ..a 1 a 0 ,a -1 a -2 …a -m will be written in binary number system as

x = a n ·2 n +a n-1 ·2 n-1 +…+a 1 ·2 1 +a 0 ·2 0 +a -1 ·2 -1 +a -2 ·2 -2 +…+a -m ·2 -m

Where a ibinary digits(0 or 1).

Octal number system

In the octal number system, the base digits are the numbers from 0 to 7. 8 low-order ones are combined into a high-order one.

Hexadecimal number system

In the hexadecimal number system, the base digits are the numbers from 0 to 15 inclusive. To designate base digits greater than 9 with one symbol, in addition to the Arabic numerals 0...9 in the hexadecimal number system, letters of the Latin alphabet are used:

10 10 = A 16 12 10 = C 16 14 10 = E 16
11 10 = B 16 13 10 = D 16 15 10 = F 16.

For example, the number 175 10 in hexadecimal number system will be written as AF 16. Really,

10·16 1 +15·16 0 =160+15=175

The table shows numbers from 0 to 16 in decimal, binary, octal and hexadecimal number systems.

Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10

Binary-octal and binary-hexadecimal conversions

The binary number system is convenient for performing arithmetic operations using microprocessor hardware, but is inconvenient for human perception because it requires large quantity discharges. Therefore in computer technology In addition to the binary number system, octal and hexadecimal number systems are widely used for a more compact representation of numbers.

Three digits of the octal number system implement everything possible combinations octal digits in the binary number system: from 0 (000) to 7 (111). To convert binary number to octal, you need to combine binary digits into groups of 3 digits (triads) in two directions, starting from the separator of the integer and fractional parts. If necessary, you need to add insignificant zeros to the left of the original number. If the number contains fractional part, then to the right of it you can also add insignificant zeros until all triads are filled. Each triad is then replaced by an octal digit.

Example: Convert the number 1101110.01 2 to octal number system.

We combine binary digits into triads from right to left. We get

001 101 110,010 2 = 156,2 8 .

To convert a number from octal to binary, you need to write each octal digit in binary code:

156,2 8 = 001 101 110,010 2 .

The four digits of the hexadecimal number system implement all possible combinations of hexadecimal digits in the binary number system: from 0 (0000) to F(1111). To convert a binary number to hexadecimal, you need to combine the binary digits into groups of 4 digits (tetrads) in two directions, starting from the decimal separator. If necessary, you need to add insignificant zeros to the left of the original number. If the number contains a fractional part, then to the right of it you also need to add insignificant zeros until all notebooks are filled. Each tetrad is then replaced with a hexadecimal digit.

Example: Convert the number 1101110.11 2 to hexadecimal number system.

We combine binary digits into tetrads from right to left. We get

0110 1110.1100 2 = 6E,C 16 .

To convert a number from hexadecimal to binary, you need to write each hexadecimal digit in binary code.







2024 gtavrl.ru.