Number Base Converter
Convert between binary, hexadecimal, decimal, and octal number systems.
Common Values Reference
| Decimal | Hex | Binary | Octal |
|---|---|---|---|
| 8 | 0x08 | 0000 1000 | 10 |
| 16 | 0x10 | 0001 0000 | 20 |
| 32 | 0x20 | 0010 0000 | 40 |
| 64 | 0x40 | 0100 0000 | 100 |
| 128 | 0x80 | 1000 0000 | 200 |
| 255 | 0xFF | 1111 1111 | 377 |
| 256 | 0x100 | 1 0000 0000 | 400 |
| 65535 | 0xFFFF | 1111 1111 1111 1111 | 177777 |
Understanding Number Bases
A number base is a positional numbering method, and positional notation is a system where the value of a digit depends on both the symbol itself and its place in the sequence. In digital systems, number representation refers to the practical choice of binary for hardware, hexadecimal for readability, and decimal for general communication.
Binary (Base 2)
Uses digits 0-1. The native language of digital circuits and computers. Each digit represents a power of 2.
Octal (Base 8)
Uses digits 0-7. Less common today but still used in some Unix/Linux file permissions.
Decimal (Base 10)
Uses digits 0-9. The standard human-readable number system we use daily.
Hexadecimal (Base 16)
Uses 0-9 and A-F. Compact representation of binary data. 1 hex digit = 4 binary bits.
Common Uses in Electronics
| Base | Symbol Set | Main Advantage | Typical Engineering Use |
|---|---|---|---|
| Binary | 0-1 | Bit-level visibility | Flags, masks, hardware states |
| Decimal | 0-9 | Human familiarity | Reports, calculations, UI display |
| Hexadecimal | 0-9, A-F | Compact binary mapping | Registers, addresses, color values |
| Octal | 0-7 | Three-bit grouping | Legacy interfaces and software contexts |
Reference Links
Frequently Asked Questions
How do I convert binary to decimal?
Multiply each binary digit by its position value (powers of 2) and sum them. For example: 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11
Why is hexadecimal commonly used?
Hex is compact (1 hex digit = 4 bits) and easy to convert to/from binary. It's widely used in programming, memory addressing, and color codes.
What do prefixes like 0x and 0b mean?
0x indicates hexadecimal, 0b indicates binary, and 0o indicates octal. These prefixes help distinguish the number base in code.
Does octal still matter?
Octal is less common in modern electronics than binary or hex, but it still appears in legacy systems and some software contexts where groups of three bits are meaningful.
How should I verify a critical conversion?
For firmware or hardware debugging, compare the converted value against the datasheet register map or source code constant so the numeric representation matches the engineering intent.
Formula Source and Checked Examples
The converter reads your input as an integer in the base you select, then writes that integer in the other three bases. It uses the positional rule: value = the sum of digit × baseposition, counting positions from 0 at the right. Going the other way it divides by the target base again and again and reads the remainders from last to first. These are the standard rules found in any digital logic textbook, and they are exact for whole numbers.
Limits: whole numbers only, no fractions and no negative values. Inputs can be up to 256 characters long. Since November 20, 2026 the tool converts with JavaScript BigInt, so every digit is exact, including 64-bit register values: decimal 9007199254740993 (253 + 1) now stays 9007199254740993 and converts to hex 0x20000000000001. Earlier builds stored the value as a floating-point number and rounded anything above 253 − 1. Until November 20, 2026 a code error made this converter show "Enter a valid number" for every input. That is fixed, and the rows below are from the fixed build.
The rows below were entered in the live calculator (local production build) and checked by hand calculation. Last run: November 20, 2026.
| Input | Decimal | Hexadecimal | Binary | Octal |
|---|---|---|---|---|
| Decimal 255 | 255 | 0xFF | 1111 1111 | 0o377 |
| Hexadecimal 3FF | 1023 | 0x3FF | 0011 1111 1111 | 0o1777 |
| Binary 10110110 | 182 | 0xB6 | 1011 0110 | 0o266 |
Hand check for row 2: 3 × 256 + 15 × 16 + 15 = 1023. Row 3: 128 + 32 + 16 + 4 + 2 = 182; 1011 is B and 0110 is 6, so 0xB6; 2 × 64 + 6 × 8 + 6 = 182, so 0o266. Found an error? Email hello@yourpcb.com.