CoderTools

Base Converter

Convert between binary, octal, decimal, and hexadecimal number systems with custom base support (2-36)

Enter a value in any field to instantly see conversions to all other number bases.

Number Base Converter Documentation

What is a Number Base (Radix)?

A number base, or radix, defines how many unique digits are used to represent numbers in a positional numeral system. The most common base in everyday life is decimal (base 10), using digits 0-9. Computers primarily use binary (base 2), while programmers frequently work with hexadecimal (base 16) and octal (base 8) for more compact representation of binary data.

Common Number Systems

Base Name Digits Common Usage
2 Binary 0, 1 Digital circuits, computer memory, machine code
8 Octal 0-7 Unix file permissions, legacy computing systems
10 Decimal 0-9 Everyday mathematics, human-readable numbers
16 Hexadecimal 0-9, A-F Memory addresses, color codes (CSS/HTML), byte representation

How Base Conversion Works

Converting a number from one base to another involves two main steps:

  1. Convert the source number to decimal (base 10) by multiplying each digit by its positional value (base^position) and summing all values
  2. Convert the decimal result to the target base using repeated division - divide by the target base and collect remainders
  3. Read the remainders in reverse order to get the final result in the target base

Conversion Example

Binary 1101 → Decimal: (1×8) + (1×4) + (0×2) + (1×1) = 13

Each binary digit position represents a power of 2: from right to left, 2⁰=1, 2¹=2, 2²=4, 2³=8, etc.

Quick Reference Table (0-15)

Decimal Binary Octal Hexadecimal

Common Use Cases

  • Programming: Debug memory addresses, understand bitwise operations, work with low-level data
  • Web Development: Convert CSS/HTML color codes between RGB decimal and hexadecimal formats
  • Networking: Understand IP addresses, subnet masks, and MAC addresses in different formats
  • Digital Electronics: Analyze logic circuits, understand binary arithmetic
  • Data Analysis: Work with encoded data, parse binary file formats

Tips & Tricks

  • Hex digits A-F represent decimal values 10-15. 0xFF equals 255 in decimal.
  • Each hex digit represents exactly 4 binary digits (bits), making hex a convenient shorthand for binary.
  • This tool uses BigInt for arbitrary precision, allowing conversion of very large numbers without precision loss.

Frequently Asked Questions

What is a number base and how does base conversion work?

A number base (or radix) defines how many unique digits are used to represent numbers. Base 10 (decimal) uses digits 0-9; base 2 (binary) uses 0-1; base 16 (hex) uses 0-9 plus A-F. To convert between bases, divide the decimal value repeatedly by the target base and collect remainders — or use positional notation to convert to decimal first, then to the target base.

Why do programmers use hexadecimal so often?

Hexadecimal is compact and maps cleanly to binary: each hex digit represents exactly 4 bits (a nibble). This makes it easy to read memory addresses, color codes, and byte values at a glance. An 8-bit byte (0-255) fits in exactly 2 hex digits, while its binary form takes 8 digits. Memory dumps, network packets, and CPU registers are all much easier to read in hex.

What is the difference between binary, octal, and hexadecimal?

All three are positional numeral systems using different bases. Binary (base 2) uses only 0 and 1 — close to how transistors work. Octal (base 8) uses digits 0-7 and was common in older Unix systems for file permissions (e.g., chmod 755). Hexadecimal (base 16) is the most common today for low-level programming, color codes, and memory representation.

How do I convert a negative number to binary?

The most common method is two's complement, used by virtually all modern CPUs. To get two's complement for a negative number: (1) write the absolute value in binary, (2) flip all bits (ones complement), (3) add 1. For example, -5 in 8-bit two's complement is 11111011. This tool converts unsigned integers; for signed/two's complement, use a dedicated bitwise calculator.

What is base 32 or base 58 encoding?

Base 32 uses 26 letters plus 2-7, totaling 32 symbols — it avoids visually confusing characters like 0/O and 1/l. Base 58 (used in Bitcoin addresses) uses a 58-character alphabet that also removes 0, O, I, and l. These encodings are used where human readability and error resistance matter more than maximum compactness.

Quick Menu

No recent tools