TFT

Number Base Converter – Binary, Octal, Decimal, Hex Converter

Convert numbers between binary, octal, decimal, and hexadecimal bases instantly with our free online number base converter. Perfect for computer science students and programmers.

Examples:

Understanding Number Bases

A number base (or radix) determines how many unique digits are used to represent numbers. Our everyday decimal system uses base 10 (digits 0-9). Computers use binary (base 2) because electronic circuits have two states: on and off. Programmers often use hexadecimal (base 16) as a compact way to represent binary data.

The position of each digit matters – it's a positional system. In decimal, the number 345 means 3x100 + 4x10 + 5x1. In binary, 101 means 1x4 + 0x2 + 1x1 = 5 in decimal.

Common Number Bases

Binary (Base 2)

Digits: 0, 1

The language of computers. Every piece of digital data is stored as binary. Eight binary digits form a byte.

1010 = 8+2 = 10 (decimal)

Octal (Base 8)

Digits: 0-7

Historically used in computing because each octal digit represents exactly 3 binary digits. Still used in Unix file permissions.

777 = rwxrwxrwx permissions

Decimal (Base 10)

Digits: 0-9

Our everyday number system, likely originating from counting on ten fingers. The standard for human communication of quantities.

345 = 3x100 + 4x10 + 5x1

Hexadecimal (Base 16)

Digits: 0-9, A-F

Compact representation of binary – each hex digit equals 4 binary digits. Used for memory addresses, colors (RGB), and MAC addresses.

FF = 255 = 11111111 (binary)

Conversion Examples

Example 1: Decimal to Binary

Convert 42 to binary
42 / 2 = 21 remainder 0
21 / 2 = 10 remainder 1
10 / 2 = 5 remainder 0
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1
Read remainders bottom-up: 101010

Example 2: Binary to Hex

Convert 10101100 to hex
Group by 4: 1010 1100
1010 = 8+2 = 10 = A
1100 = 8+4 = 12 = C
Result: AC (hex)

Example 3: Hex to Decimal

Convert 1A3F to decimal
1 x 16^3 = 1 x 4096 = 4096
A x 16^2 = 10 x 256 = 2560
3 x 16^1 = 3 x 16 = 48
F x 16^0 = 15 x 1 = 15
Sum: 4096 + 2560 + 48 + 15 = 6719

Example 4: RGB Color Values

Color #FF5733 to decimal RGB
FF (red) = 255
57 (green) = 5x16 + 7 = 87
33 (blue) = 3x16 + 3 = 51
RGB(255, 87, 51) - an orange color

Quick Fact

The hexadecimal system was introduced by IBM in the 1960s. Before that, some computers used octal. The letters A-F were chosen because they're the first six letters after the digits 0-9, making them easy to distinguish. Some early systems used other symbols for values 10-15!

Frequently Asked Questions

Why do programmers use hexadecimal?

Hex is compact and converts easily to binary. One hex digit = 4 bits (a nibble), two hex digits = 8 bits (a byte). It's much easier to read and write "0xFF" than "11111111" or even "255".

What does 0x mean before a number?

The prefix "0x" indicates a hexadecimal number in programming. So 0xFF means FF in hex = 255 in decimal. Similarly, "0b" prefix indicates binary (0b1010 = 10).

How do I convert without a calculator?

To convert to decimal: multiply each digit by its place value and add. To convert from decimal: repeatedly divide by the target base and collect remainders. For binary/hex, group bits by 4.

What is two's complement?

Two's complement is how computers represent negative numbers in binary. Invert all bits and add 1. For example, -1 in 8-bit is 11111111 (invert 00000000, add 1).

Why is octal still used?

Unix and Linux file permissions use octal notation. The permission "755" means rwxr-xr-x. Each digit represents read(4) + write(2) + execute(1) permissions for owner, group, and others.

Can bases be larger than 16?

Yes! Base 32 and base 64 are used for encoding binary data as text (like in URLs and email). Base 64 uses A-Z, a-z, 0-9, +, and / to represent 6 bits per character.

Other Free Tools

Binary Addition & Subtraction Calculator – Compute in Base 2

Add and subtract binary numbers step by step with our free online binary calculator. See each bit-by-bit operation clearly – perfect for computer science and digital electronics.

Two's Complement Calculator – Convert to Twos Complement

Convert any integer to its two's complement binary form or decode two's complement back to decimal with our free online calculator. Supports various bit widths.

Bitwise Operations Calculator – Compute AND OR XOR NOT Shifts

Perform bitwise AND, OR, XOR, NOT, left shift, and right shift operations on integers with our free online bitwise calculator. See binary representations alongside results.

Truth Table Generator – Create Logic Truth Tables Online

Generate truth tables for any logical expression with our free online truth table generator. Supports AND, OR, NOT, XOR, NAND, NOR, and implication operators for any number of variables.

Boolean Expression Evaluator – Evaluate Logic Expressions Online

Evaluate any Boolean expression for given variable values with our free online Boolean expression evaluator. Supports all logical operators including AND, OR, NOT, XOR, and more.

Roman Numeral Converter – Convert Numbers to Roman Numerals

Convert any integer to Roman numerals or translate Roman numerals back to numbers with our free online Roman numeral converter. Instant, accurate conversions for any value.

Data Storage Converter – Convert KB, MB, GB, TB Online

Convert between any digital storage unit with our free online data storage converter. Supports bytes, kilobytes, megabytes, gigabytes, terabytes, and petabytes instantly.

Scientific Notation Converter – Standard to Scientific Form

Convert any number to scientific notation or from scientific notation to standard form with our free online converter. Perfect for chemistry, physics, and large number calculations.