Base Converter (Radix)

Simultaneously convert a number between Decimal, Binary, Hex, and Octal.

Decimal (Base 10)
Binary (Base 2)
Hexadecimal (Base 16)
Octal (Base 8)

How to Use

1

Enter a number in any base

Type a value in decimal, binary, hexadecimal, or octal — all fields update automatically.

2

View all four base representations

See the equivalent value in all four number systems simultaneously in one step.

3

Use hex letters A-F freely

Hexadecimal input accepts both upper and lowercase letters A through F.

4

Rely on BigInt precision

Large 64-bit programming values convert accurately without floating-point rounding errors.

What are Number Bases?

A number base specifies how many unique digits are used to represent numbers. Base conversion is a core computer science skill.

Real-World Examples & Use Cases

Computer Science Education and Programming

Computer science students learn that all data at the hardware level is binary — but reading long binary strings is impractical. Hexadecimal serves as a compact binary shorthand: each hex digit represents exactly 4 binary bits. A byte (8 bits) requires 8 binary digits but only 2 hex digits: 11001010 = 0xCA = 202 decimal. Students learning about data types, bit masking, memory addresses, and instruction sets convert constantly between these representations to understand what programs are actually doing at the machine level.

Color Codes in Web and Graphic Design

CSS and web design use hexadecimal color codes: #FF5733 means Red=0xFF=255, Green=0x57=87, Blue=0x33=51. Understanding that #FF0000 is pure red (Red=255, Green=0, Blue=0) and #808080 is medium gray (128, 128, 128) requires decimal-hex conversion. Graphics designers adjusting color values in code and converting between hex color codes and RGB decimal values use base conversion constantly. The relationship between 0x00-0xFF and 0-255 is central to digital color theory.

Memory Addresses and Pointer Arithmetic

Debuggers, disassemblers, and system-level programming tools display memory addresses in hexadecimal: 0x7FFF5FBFF8A0. Calculating address offsets requires hex arithmetic. An array element at 0x1000 with each element 4 bytes apart: element[5] is at 0x1000 + (5 × 4) = 0x1000 + 0x14 = 0x1014 = 4116 decimal. Systems programmers and embedded engineers convert addresses, register values, and flag bits between binary/hex/decimal throughout development and debugging workflows.

File Permissions in Unix/Linux Systems

Unix file permissions are represented in octal: chmod 755 sets owner (read+write+execute = 4+2+1 = 7), group (read+execute = 4+1 = 5), others (read+execute = 5). Understanding that 777 = 0b111_111_111 (all bits set for all groups) and 644 = 0b110_100_100 (owner read/write, group and others read-only) requires octal-to-binary conversion. System administrators setting file permissions, umask values, and special bits (setuid=4000, setgid=2000, sticky=1000) work with octal representations directly.

How It Works

Base conversion algorithms: Decimal to any base B: 1. Divide decimal number by B, record remainder 2. Repeat with quotient until quotient = 0 3. Read remainders bottom-to-top for the result Example: Decimal 156 to Binary (Base 2): 156 ÷ 2 = 78 R0 78 ÷ 2 = 39 R0 39 ÷ 2 = 19 R1 19 ÷ 2 = 9 R1 9 ÷ 2 = 4 R1 4 ÷ 2 = 2 R0 2 ÷ 2 = 1 R0 1 ÷ 2 = 0 R1 Binary: 10011100 = 0x9C (hex) = 234 (octal) Any base to decimal: Multiply each digit by its base position value and sum: 10011100 binary = 1×2^7 + 0×2^6 + 0×2^5 + 1×2^4 + 1×2^3 + 1×2^2 + 0×2^1 + 0×2^0 = 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 Hex shortcut: each hex digit = 4 binary bits 0-9: same as decimal; A=10, B=11, C=12, D=13, E=14, F=15

Frequently Asked Questions

Why do computers use binary instead of decimal?
Electronic circuits are most reliably built with two stable states: on (1) and off (0). Representing 10 distinct voltage levels for decimal would require far more complex circuits with higher error rates. Binary's two states map perfectly to transistor on/off switching, magnetic polarization, pit/land on optical discs, and any other bistable physical medium. Binary arithmetic is also implemented efficiently in hardware: addition, multiplication, and logical operations are straightforward with two-state logic gates.
Why is hexadecimal used in programming instead of binary?
Binary is the underlying reality, but reading 32 or 64-bit binary strings is tedious and error-prone. Hexadecimal is a compact human-readable shorthand: every 4 binary bits correspond to exactly one hex digit. A 32-bit value requires 32 binary digits but only 8 hex digits: 11001010 11110000 10101010 00001111 = 0xCAF0AA0F. This perfect power-of-2 relationship means hex and binary convert without arithmetic — just a lookup table. Octal (8 = 2^3) offers similar benefits on systems aligned to 3-bit groups.
What do 0x and 0b prefixes mean in code?
These are notation prefixes indicating the number base in programming languages. 0x (or 0X) precedes a hexadecimal number: 0xFF = 255 decimal. 0b (or 0B) precedes a binary number: 0b1010 = 10 decimal. 0 alone (in C-style languages) precedes an octal number: 010 = 8 decimal (which causes subtle bugs when programmers zero-pad decimal numbers!). In Python, JavaScript, Java, C, and most modern languages, these prefixes work universally.
How are colors represented in hexadecimal?
Web colors use 6 hex digits representing three byte-sized values: #RRGGBB where RR = red (00-FF), GG = green (00-FF), BB = blue (00-FF). Each component ranges from 0 (00 hex) to 255 (FF hex). #FF0000 is pure red, #00FF00 is pure green, #0000FF is pure blue, #FFFFFF is white, #000000 is black. The 8-digit #RRGGBBAA version adds an alpha (transparency) channel. CSS also supports shorthand: #RGB where each digit is doubled (#F0A = #FF00AA).
What is BigInt and why is it needed for base conversion?
Standard floating-point numbers (JavaScript's default Number type) can only represent integers exactly up to 2^53 - 1 (9,007,199,254,740,991). For 64-bit system values, memory addresses, and large binary numbers that commonly exceed this limit, regular arithmetic produces incorrect results due to floating-point truncation. BigInt (arbitrary precision integers) handles numbers of any size exactly. For example, the max 64-bit unsigned integer (0xFFFFFFFFFFFFFFFF = 18,446,744,073,709,551,615) exceeds Number's safe range and requires BigInt for accurate conversion.

Related Tools

Explore other tools in this category.

Looking for something else?