๐Ÿ”ข Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal instantly. Supports large numbers and shows all bases simultaneously. Free online number base converter.

0-9
0-1
0-9 A-F
0-7

How to Use

1

Enter any number

Type a number into any of the four fields: Decimal, Binary, Hexadecimal, or Octal.

2

All bases update instantly

The other three fields automatically update with the equivalent value in real-time.

3

Copy any format

Click the Copy button next to any field to copy that representation to your clipboard.

Frequently Asked Questions

What are the different number bases? +
Decimal (base 10) uses digits 0-9 and is the everyday number system. Binary (base 2) uses only 0 and 1, used by computers. Octal (base 8) uses digits 0-7. Hexadecimal (base 16) uses 0-9 and A-F, widely used in programming for memory addresses and colors.
What does 0x prefix mean in hexadecimal? +
0x is the standard prefix for hexadecimal numbers in most programming languages (C, JavaScript, Python). So 0xFF = 255 in decimal. Similarly, 0b prefix is used for binary (0b11111111 = 255).
How do I convert a hex color code to RGB? +
A hex color like #FF5733 has three pairs: FF (red), 57 (green), 33 (blue). Convert each pair from hex to decimal: FF=255, 57=87, 33=51. Result: rgb(255, 87, 51). Our Color Picker tool does this automatically.
What is the largest number supported? +
The tool handles integers up to JavaScript's Number.MAX_SAFE_INTEGER (2^53 - 1 = 9,007,199,254,740,991). For very large numbers (64-bit+), precision may be limited.
Is any data sent to a server? +
No. All conversions are calculated in your browser using JavaScript's built-in parseInt() and toString() functions. Nothing is sent anywhere.
๏ปฟ

Complete Guide: Number Base Converter

Computers store and process all data as binary โ€” sequences of 0s and 1s. But binary is verbose and difficult for humans to read. Programmers regularly work with hexadecimal (base 16) and occasionally octal (base 8) as more compact representations of the same underlying bit patterns. Understanding number base conversions is fundamental to low-level programming, networking, color theory, and cryptography.

Positional Notation: The Core Concept

In any positional number system, each digit's value depends on its position. In base 10 (decimal), the number 253 means (2 ร— 10ยฒ) + (5 ร— 10ยน) + (3 ร— 10โฐ) = 200 + 50 + 3. The same principle applies to any base. Binary 1011 means (1 ร— 2ยณ) + (0 ร— 2ยฒ) + (1 ร— 2ยน) + (1 ร— 2โฐ) = 8 + 0 + 2 + 1 = 11 decimal. Hexadecimal uses digits 0โ€“9 then Aโ€“F, where A=10, B=11, C=12, D=13, E=14, F=15.

Why Programmers Love Hexadecimal

The key insight is that one hexadecimal digit represents exactly four binary digits (a nibble). This means one byte (8 bits) maps to exactly two hex digits. For example, the binary value 11111111 is FF in hex and 255 in decimal. This compact mapping makes it easy to inspect raw memory, define colors, and work with cryptographic hashes without the verbosity of binary.

Two's Complement for Negative Numbers

Computers represent negative integers using two's complement. To find the two's complement of a number: invert all bits, then add 1. For an 8-bit representation, -1 is 11111111 (0xFF), and -128 is 10000000 (0x80). The most significant bit (leftmost) serves as the sign bit โ€” 1 means negative, 0 means positive. This is why a signed 8-bit integer ranges from -128 to 127, while an unsigned 8-bit integer ranges from 0 to 255.

Bit Shifting Operations

Bit shifting is effectively multiplication or division by powers of 2:

Bit shifting is commonly used in graphics pipelines, compression algorithms, and bitfield manipulation where speed matters.

Color Hex to RGB Conversion

CSS hex colors like #1A2B3C encode three pairs of hex digits, each representing one color channel. Split the six digits into pairs: 1A, 2B, 3C. Convert each pair from hex to decimal: 0x1A = 26, 0x2B = 43, 0x3C = 60. The result is rgb(26, 43, 60). The shorthand #RGB format doubles each digit: #ABC = #AABBCC.

IPv4 Addresses in Hex

IPv4 addresses are four bytes. The loopback address 127.0.0.1 in hex is 7F.00.00.01. Network engineers and low-level socket programmers often encounter IP addresses stored as 32-bit integers in hex, especially in packet dumps and kernel source code.

JavaScript: parseInt and toString

JavaScript provides built-in base conversion:

// String of any base to decimal integer
parseInt('FF', 16);   // 255
parseInt('1010', 2);  // 10
parseInt('17', 8);    // 15

// Decimal integer to string of any base
(255).toString(16);   // "ff"
(10).toString(2);     // "1010"
(255).toString(8);    // "377"

Be careful: parseInt silently ignores invalid characters after the last valid digit rather than throwing an error. Always validate input before calling it.

For converting hex color values interactively, see the Color Picker. For computing hex-encoded hash values, use the Hash Generator.

๐Ÿงฐ 50+ Tools