Binary • Decimal • Hexadecimal Converter

Instantly convert between binary (base‑2), decimal (base‑10), and hexadecimal (base‑16) number systems.

0b
Valid binary (0/1 only)
dec
Non‑negative integer range 0 – 2⁵³-1
0x
Digits 0‑9, A‑F (case insensitive)
? 255 (Max 8‑bit) ⚡ 4095 (FFF) ? Binary 1010 ? DEADBEEF ? 42 (Answer)
Range & precision: Supports non‑negative integers up to 9,007,199,254,740,991 (Number.MAX_SAFE_INTEGER). For larger numbers, results may lose integer precision. Binary and hex fields accept up to 54 bits. Works offline
Live conversion breakdown
Enter a value in any field to see the positional notation and conversion method.

? Quick Reference: 0–15 in Decimal, Binary & Hex

Decimal Binary (4‑bit) Hexadecimal Decimal Binary (4‑bit) Hexadecimal

Number Systems: A Deep Dive into Binary, Decimal & Hexadecimal

Understanding different numeral systems is fundamental to computer science, digital electronics, and low‑level programming. Our converter provides real‑time translation between the three most essential bases: binary (the language of computers), decimal (human‑friendly), and hexadecimal (compact binary shorthand).

Why Different Bases Matter

  • Binary (Base‑2): Every bit represents a power of two. Used in CPUs, memory addressing, and network masks. Directly reflects hardware states (0/1).
  • Decimal (Base‑10): Our everyday counting system, rooted in ten digits.
  • Hexadecimal (Base‑16): Each hex digit corresponds to 4 binary bits, making it extremely convenient for representing memory addresses, color codes (e.g., #FFA500), and debugging machine code.
✍️ Conversion algorithms (mathematical foundation)
Binary → Decimal: Multiply each bit by 2ⁿ (n from right, starting at 0) and sum. Example: 1011₂ = 1·2³ + 0·2² + 1·2¹ + 1·2⁰ = 8+0+2+1 = 11₁₀.
Decimal → Binary: Repeated division by 2, reading remainders upwards. Example: 13₁₀ → 13/2=6 rem1, 6/2=3 rem0, 3/2=1 rem1, 1/2=0 rem1 → 1101₂.
Hex ↔ Binary: Each hex digit maps to a 4‑bit nibble (e.g., F=1111, A=1010).
Decimal ↔ Hex: Repeated division by 16, using digits 0‑9 & A‑F.
Practical example: Bitmask using hexadecimal

In programming, bitmasks are often expressed in hex for clarity. For instance, to extract the lower 4 bits of a number, you can use value & 0x0F. With our converter, you can instantly see that 0x0F equals decimal 15 and binary 00001111. This helps when debugging register flags or network protocol headers.

Try entering 0x0F in the hex field and observe the binary and decimal representations.

Real‑world Applications

IP Addressing & Subnetting

IPv4 addresses are often represented in dotted decimal, but subnet masks and CIDR rely on binary understanding. Hex appears in IPv6.

Web Design (Colors)

CSS hex colors like #FF5733 directly map to RGB components via hex values: FF = 255, 57 = 87, 33 = 51.

Embedded Systems

Registers, bitmasks, and memory dumps are displayed in hex, while binary shows individual flag states.

Common mistakes and how to avoid them
  • Leading zeros in hex: 0x001F is the same as 0x1F – the converter automatically normalizes, but be aware that some systems require a fixed width.
  • Confusing 0b and 0x prefixes: The tool does not require prefixes; it accepts plain digits. However, when copying values for code, always add the appropriate prefix (0b for binary, 0x for hex).
  • Assuming hex is case‑insensitive everywhere: It is here, but some parsers may require uppercase; we output uppercase for consistency.
  • Misinterpreting binary groups: When converting binary to hex, remember to group from the right (least significant side).
Handling signed integers (two's complement)

This tool focuses on unsigned integers. For signed numbers (e.g., in programming languages like C or Java), negative values are typically represented using two's complement. To convert a negative decimal to binary/hex using two's complement, first decide the bit width (e.g., 8, 16, 32), then add 2ⁿ to the negative number to get its unsigned representation. For example, -1 in 8-bit two's complement is 0xFF (255 decimal). You can use our converter to obtain the unsigned value and then interpret it as signed.

Floating-point numbers?

Our tool handles only integers. For floating-point conversion (e.g., IEEE 754 single/double precision), specialized tools are required. However, the integer part can be converted using this tool, and the fractional part can be handled by repeated multiplication by 2 (binary) or 16 (hex) – a common exercise in computer science courses.

Reviewed by the GetZenQuery Tech Team

All algorithms are verified against authoritative references including Wolfram MathWorld and classic texts like The C Programming Language (Kernighan & Ritchie).Last content review: March 2026 

Conversions are performed locally in your browser – no data leaves your device, ensuring privacy and offline availability.

Frequently Asked Questions

Transistors have two stable states (on/off), making binary the natural choice for digital logic. Binary simplifies circuit design and error resilience.

Hex is much more compact: 4 bits become one digit. It reduces human error when reading long binary strings and is widely used in assembly, memory dumps, and color encoding.

This tool focuses on integers for clarity and performance. For floating‑point conversion, specialized IEEE‑754 tools are recommended. However, the principles extend using radix point.

The tool validates each field in real time. If you type an invalid character (e.g., ‘G’ in hex), the field turns invalid and the other fields are not updated, preserving the last valid state.

We restrict to integers ≤ 2⁵³‑1 (Number.MAX_SAFE_INTEGER) to guarantee exact integer representation. Above that, floating‑point rounding may occur. The UI warns when exceeding safe range.

The tool outputs unsigned representation. For two's complement, choose a bit width, add 2ⁿ to a negative number to get its unsigned equivalent, then convert. For example, -1 in 8-bit becomes 255 (0xFF). Use our converter to see the hex/binary representation.
Trusted references: Algorithms derived from Wolfram MathWorld, IEEE 754 standard, and classical computer science texts (Kernighan & Ritchie, “The C Programming Language”). All conversions are performed client‑side and verified with exhaustive test vectors.