Number Base Converter
Convert numbers between decimal, hexadecimal, octal, and binary instantly. Type in any base to update all others.
Base 10 — digits 0–9
Base 16 — digits 0–9 and A–F
Base 8 — digits 0–7
Base 2 — digits 0 and 1
What is a Number Base Converter?
A number base converter translates integers between different positional numeral systems — most commonly binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Each base uses a different set of digits: binary uses 0 and 1; octal uses 0–7; decimal uses 0–9; hexadecimal uses 0–9 and A–F. Understanding base conversion is fundamental to computer science, low-level programming, networking, and digital electronics.
Common Use Cases
- Convert hex colour codes to decimal RGB values (or vice versa) for CSS and design work
- Decode binary or hexadecimal values from network packet captures and protocol documentation
- Calculate IP subnet masks and CIDR ranges in binary
- Read and write binary flags and bitmasks in embedded systems or OS code
- Understand assembly language operands that are expressed in hex or binary
How It Works
Conversion is a two-step process: first parse the input string in the source base to get an integer value, then format that integer in the target base. This tool uses JavaScript's BigIntfor arbitrary-precision arithmetic, so it handles numbers larger than 2⁵³ − 1 (the limit of JavaScript's regular Number type) without losing precision — essential for 64-bit values common in networking and cryptography.
Frequently Asked Questions
Why is hexadecimal used so often in programming?
Hexadecimal is a compact representation of binary — one hex digit maps exactly to four bits (a nibble). This makes hex ideal for representing memory addresses, byte values, colour codes, and bitmasks. Reading 0xFF is much easier than reading 11111111.
How do I convert a negative number to binary?
Negative integers in computers are most commonly represented in two's complement. To convert: invert all bits of the positive value and add 1. The result's most significant bit is 1 for negative numbers. The bit width (8, 16, 32, 64) matters for the result.
Can I convert between any two bases, or only the common ones?
Mathematically, conversion works between any bases 2–36 (using digits 0–9 and letters A–Z). This tool supports bases 2 through 36. Less common bases like base 3 (ternary) and base 60 (sexagesimal, used for time) are valid inputs.
Related Tools
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes instantly.
JSON Formatter
Format, validate, and minify JSON data instantly.
Unix Timestamp
Convert Unix timestamps to human-readable dates and back.
UUID Generator
Generate UUID v4 values instantly, with bulk generation and validation.
Base64 Encoder
Encode and decode strings using Base64 encoding.
URL Encoder
Encode and decode URLs with percent-encoding instantly.
JWT Decoder
Decode and inspect JSON Web Tokens securely in your browser.
Regex Tester
Test and debug regular expressions with live match highlighting.
SQL Formatter
Format and minify SQL with dialect support for MySQL, PostgreSQL, and more.
Color Converter
Convert colours between HEX, RGB, HSL, HSV, and CMYK formats.
BigInt precision: Conversion uses JavaScript's native BigInt type, so there's no loss of precision for integers beyond 64-bit. Binary output is grouped into nibbles (4-bit blocks) for readability.
Only non-negative integers are supported. All conversion happens locally in your browser.