# Binary to Hex Converter Online Tool

Binary Number2

Hex Number16

Decimal Number10

Octal Number8

## About Binary to Hex Converter Online Tool:

This online binary to hex converter tool helps you to convert one input binary number (base 2) into a hex number (base 16).

## Binary Numeral System:

Binary numeral system has 2 digits, include `(0, 1)`. Four binary digits can be represented by 1 hexadecimal digits, and three binary digits can be represented by one octal digits. Binary is the numeral system that most close to electronic circuit hardware.

## Hex Numeral System:

Hex numeral system (also called hexadecimal) has 16 digits, include `(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)` just like decimal numeral system, plus `(a, b, e, d, e, f)` 6 additional characters. Which means it's is a number system of base 16. Since Hex numeral system can represent any binary string in a readable way, It is widely used in computer science. The SHA256 hash string is often appears as Hex style string, the Color System used in HTML is also be written down as Hex number, from `#000000` (pure black) to `#FFFFFF` (pure white). ## Binary to Hex conversion table:

Binary Hex Binary Hex
1 1 10101 15
10 2 10110 16
11 3 10111 17
100 4 11000 18
101 5 11001 19
110 6 11010 1a
111 7 11011 1b
1000 8 11100 1c
1001 9 11101 1d
1010 a 11110 1e
1011 b 11111 1f
1100 c 100000 20
1101 d 100001 21
1110 e 100010 22
1111 f 100011 23
10000 10 100100 24
10001 11 100101 25
10010 12 100110 26
10011 13 100111 27
10100 14 101000 28

Wikipedia (Binary): https://en.wikipedia.org/wiki/Binary_number

## Convert Binary to Hex with Python:

```def binary_to_hex(binary_str):
decimal_number = int(binary_str, 2)
hex_number = hex(decimal_number)
return hex_number

binary_input = '1101'
hex_output = binary_to_hex(binary_input)
print('hex result is:{0}'.format(hex_output))

-------------------
hex result is:0xd```

## Convert Binary to Hex with Java:

```public class NumberConvertManager {
public static String binary_to_hex(String binary_str) {
int decimal_int = Integer.parseInt(binary_str, 2);
return Integer.toHexString(decimal_int);
}

public static void main(String[] args) {
String binary_input = "1101";
String hex_output = binary_to_hex(binary_input);
System.out.println("hex result is:" + hex_output);
}
}

-------------------
hex result is:d```