Number Base Converter — Free Online Tool

Convert between number bases: binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16). Programmer calculator. Custom bases (2-36).

Use this free online Number Base Converter directly in your browser. No signup required, no data leaves your device. Part of Utilier — a collection of 133+ developer utilities.

What is Number Base Converter (Binary, Octal, Decimal, Hexadecimal)?

Number base converter translates numbers between numeral systems: binary (base 2: 0-1), octal (base 8: 0-7), decimal (base 10: 0-9), hexadecimal (base 16: 0-9,A-F), and custom bases (base 2-36). Converts: decimal 255 → binary 11111111, hex FF, octal 377. Binary 1010 → decimal 10, hex A, octal 12. Hex DEADBEEF → decimal 3735928559. Useful for: programming (bitwise operations, color codes #FF5733), computer science (memory addresses 0x7FFF, file permissions 755), networking (IP addresses, subnet masks), cryptography (hash values in hex). Calculator supports: arithmetic in any base (binary 1010 + 1100 = 10110), signed/unsigned integers, two's complement (negative numbers), floating-point (IEEE 754 binary).

  • Decimal (base 10): Standard number system. Digits: 0-9. Positional: 123 = 1×10² + 2×10¹ + 3×10⁰ = 100 + 20 + 3. Used everywhere (math, science, daily life).
  • Binary (base 2): Computer number system. Digits: 0, 1. Positional: 1010 = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10 (decimal). Used: CPU instructions, flags, bitwise operations.
  • Hexadecimal (base 16): Compact binary representation. Digits: 0-9, A-F (A=10, F=15). 1 hex digit = 4 binary bits (F = 1111). Used: color codes (#FF5733), memory addresses (0xDEADBEEF), hash values (SHA-256).
  • Octal (base 8): Digits: 0-7. 1 octal digit = 3 binary bits (7 = 111). Used: Unix file permissions (chmod 755 = rwxr-xr-x), legacy systems. Less common than hex.
  • Custom bases (2-36): Base 2-36 (digits: 0-9, A-Z). Example: base 36 uses 0-9, A-Z (Z = 35). Used: URL shorteners (compact IDs), encoding. Base 64 uses different alphabet (+, /).

Why use number base?

Need to convert between number systems for programming, networking, debugging, or learning computer science.

  • Understand binary (programming): Bitwise operations: 1010 & 1100 = 1000 (AND). Flags: 0b0001 | 0b0010 = 0b0011 (OR). Convert decimal to binary to see bit patterns.
  • Decode hex values: Memory addresses: 0x7FFFFFFF. Color codes: #FF5733 → RGB(255, 87, 51). Hash values: SHA-256 in hex. Convert hex to decimal/binary to understand values.
  • Unix permissions (octal): chmod 755 → rwxr-xr-x. 755 in octal = 111 101 101 in binary (owner: rwx, group: r-x, others: r-x). Convert octal to binary to decode permissions.
  • Network calculations: IP addresses: 192.168.1.1 → 11000000.10101000.00000001.00000001 (binary). Subnet masks: 255.255.255.0 = /24. Convert to binary for subnetting.
  • Debug low-level code: Assembly, C/C++: pointer addresses in hex (0xBAADF00D), flags in binary (0b1010). Convert between bases to understand memory layout, bitwise logic.
  • Learn number systems: Understand positional notation (1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰). See how bases work. Practice conversions (decimal ↔ binary ↔ hex).

When to use number base

Use whenever working with different number systems.

  • Programming (binary flags, hex color codes, bitwise operations).
  • Debugging (memory addresses in hex, binary bit patterns).
  • Unix permissions (octal chmod 755 → binary 111 101 101).
  • Networking (IP addresses in binary, hex MAC addresses).
  • Cryptography (hash values in hex → binary).
  • Computer science education (learning number systems, positional notation).
  • Low-level programming (assembly, embedded systems, bit manipulation).
  • Web development (hex color codes #RRGGBB → decimal RGB values).

How to use number base

Enter number in one base, see conversions to other bases.

  1. Select input base: Choose: binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16), or custom (base 2-36). Or auto-detect (0b prefix = binary, 0x = hex, 0o = octal).
  2. Enter number: Type number: 255 (decimal), 0xFF (hex), 0b11111111 (binary), 0o377 (octal). Hex: use 0-9, A-F (case-insensitive). Binary: 0-1 only.
  3. View conversions: Tool shows: decimal, binary, octal, hexadecimal. Example: input 255 → binary: 11111111, octal: 377, hex: FF. All bases shown simultaneously.
  4. Copy result: Click to copy: 0xFF (hex with prefix), FF (hex without prefix), 11111111 (binary), 377 (octal). Paste into code, config files.
  5. Arithmetic (optional): Add, subtract, multiply in any base. Example: binary 1010 + 1100 = 10110. Or hex FF + 1 = 100. Results shown in all bases.
  6. Use custom base: Enter base (2-36). Example: base 36 (digits 0-9, A-Z). Convert Z (base 36) → 35 (decimal). Used: URL shorteners, compact encoding.
  7. Toggle signed/unsigned: Unsigned: 0-255 (8-bit). Signed: -128 to 127 (two's complement). Negative in binary: 11111111 = -1 (signed) or 255 (unsigned).

Key features

  • Multi-base conversion: Simultaneous display: decimal, binary, octal, hex. Input in one base → see all bases. Example: 255 → 11111111 (binary), 377 (octal), FF (hex).
  • Auto-detection: Detects base from prefix: 0b1010 → binary, 0xFF → hex, 0o77 → octal. Or manually select base. No need to specify explicitly.
  • Arithmetic in any base: Calculator: binary 1010 + 1100, hex FF × 2, octal 77 - 10. Results in all bases. Useful for bitwise operations (AND, OR, XOR, NOT).
  • Signed/unsigned integers: Toggle signed (two's complement: -128 to 127 for 8-bit) vs unsigned (0-255). Shows how negative numbers represented in binary (11111111 = -1 or 255).
  • Custom bases (2-36): Base 2-36 (digits: 0-9, A-Z). Example: base 36 (0-9, A-Z), base 12 (duodecimal: 0-9, A-B). Rare bases for specialized encoding.
  • Bit width selection: 8-bit, 16-bit, 32-bit, 64-bit. Affects range: 8-bit = 0-255 (unsigned) or -128-127 (signed). Hex padding: 8-bit → 0x0F, 16-bit → 0x000F.
  • Copy with prefixes: Copy hex: 0xFF or FF. Binary: 0b1010 or 1010. Octal: 0o77 or 77. Configurable (with/without prefix for code compatibility).

Common use cases

  • Hex color codes: #FF5733 → R: 255 (FF), G: 87 (57), B: 51 (33). Convert hex to decimal RGB. Or decimal RGB → hex: rgb(255, 87, 51) → #FF5733. CSS, design.
  • Binary flags (bitwise): Permissions: READ = 0b0001, WRITE = 0b0010, EXECUTE = 0b0100. Combine: READ | WRITE = 0b0011 (decimal 3). Check: flags & READ (has READ permission?).
  • Unix chmod (octal): chmod 755 → octal 755 → binary 111 101 101 → owner: rwx (7), group: r-x (5), others: r-x (5). Convert octal to binary to decode permissions.
  • IP address to binary: 192.168.1.1 → 11000000.10101000.00000001.00000001. Each octet (192, 168, 1, 1) → 8-bit binary. Subnetting: /24 = 255.255.255.0 (binary 11111111.11111111.11111111.00000000).
  • Memory addresses (hex): Pointer: 0x7FFFFFFF → decimal 2147483647 → binary 01111111111111111111111111111111. Debug memory layout, stack/heap addresses.
  • SHA hash (hex to binary): SHA-256: 0a1b2c3d... (hex) → binary. Understand hash structure. Or compare hashes: convert to decimal, check equality.

Examples

Number base conversion examples.

Decimal 255 to other bases

Decimal: 255
Binary: 11111111 (0b11111111)\nOctal: 377 (0o377)\nHex: FF (0xFF)

255 = 8 bits set (11111111). Max value for unsigned 8-bit integer. Hex FF = octal 377 = binary 11111111.

Hex color #FF5733 to RGB

Hex: FF5733
R: FF (hex) = 255 (decimal)\nG: 57 (hex) = 87 (decimal)\nB: 33 (hex) = 51 (decimal)\nRGB(255, 87, 51)

Split hex color: FF (red), 57 (green), 33 (blue). Convert each pair hex to decimal. Use in CSS: rgb(255, 87, 51).

Binary 1010 to decimal, octal, hex

Binary: 1010 (0b1010)
Decimal: 10\nOctal: 12 (0o12)\nHex: A (0xA)

1010₂ = 1×8 + 0×4 + 1×2 + 0×1 = 10₁₀. 10₁₀ = 12₈ (1×8 + 2×1). 10₁₀ = A₁₆.

Octal chmod 755 to binary (permissions)

Octal: 755
Binary: 111 101 101\nOwner: 111 (rwx, 7)\nGroup: 101 (r-x, 5)\nOthers: 101 (r-x, 5)

Octal 755 → 3 octal digits → 9 binary bits (3 bits each). 7 = 111 (rwx), 5 = 101 (r-x). chmod 755 = rwxr-xr-x.

Hex 0xDEADBEEF to decimal

Hex: DEADBEEF (0xDEADBEEF)
Decimal: 3735928559

32-bit hex value (memory address, magic number). D×16⁷ + E×16⁶ + A×16⁵ + D×16⁴ + B×16³ + E×16² + E×16¹ + F×16⁰.

Technical reference

Number base systems and conversion formulas:

Decimal (base 10)
Digits: 0-9. Positional: 123 = 1×10² + 2×10¹ + 3×10⁰ = 100 + 20 + 3. Standard number system. Conversion to decimal: sum of digit × base^position.
Binary (base 2)
Digits: 0, 1. Positional: 1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 2 = 10₁₀. Used: computers (CPU, memory, logic gates). Prefix: 0b (0b1010).
Octal (base 8)
Digits: 0-7. Positional: 377₈ = 3×8² + 7×8¹ + 7×8⁰ = 192 + 56 + 7 = 255₁₀. 1 octal digit = 3 binary bits (7 = 111). Used: Unix permissions (chmod 755). Prefix: 0o.
Hexadecimal (base 16)
Digits: 0-9, A-F (A=10, B=11, C=12, D=13, E=14, F=15). Positional: FF₁₆ = 15×16¹ + 15×16⁰ = 240 + 15 = 255₁₀. 1 hex digit = 4 binary bits (F = 1111). Prefix: 0x.
Conversion formulas
Decimal to base: divide by base, collect remainders (reverse order). Base to decimal: sum of digit × base^position. Binary ↔ hex: group 4 bits per hex digit (1111 = F).
Two's complement (signed)
Negative numbers in binary. 8-bit: -1 = 11111111 (invert bits + 1). Range: -128 to 127 (8-bit), -32768 to 32767 (16-bit). MSB (most significant bit) = sign (1 = negative).
Bit widths
8-bit: 0-255 (unsigned), -128 to 127 (signed). 16-bit: 0-65535, -32768 to 32767. 32-bit: 0-4294967295, -2147483648 to 2147483647. 64-bit: larger.
Prefixes
Binary: 0b (0b1010), hex: 0x (0xFF), octal: 0o (0o77). C/C++: 0x for hex (0xFF), 0 for octal (077, confusing). Python: 0b, 0o, 0x.
Hex to binary
Each hex digit = 4 binary bits. FF → 1111 1111, A5 → 1010 0101, DEADBEEF → 1101 1110 1010 1101 1011 1110 1110 1111. Quick conversion (lookup table).
Custom bases (2-36)
Base N uses digits 0 to N-1. Base 36: digits 0-9, A-Z (Z = 35). Base 64 (different): A-Z, a-z, 0-9, +, / (not standard base conversion). Used: compact encoding.

Common mistakes to avoid

Using octal prefix 0 instead of 0o (confusing in code)

Why it happens: C/C++: 077 = octal 77 (leading 0). Python 2: 077 = octal. Python 3: 077 = SyntaxError (use 0o77). JavaScript: 077 = octal (strict mode: error). Confusing, error-prone.

How to avoid it: Use explicit prefix: 0o77 (octal), 0x77 (hex), 0b111 (binary). Python 3, modern languages prefer explicit prefixes. Avoid leading 0 for octal.

Forgetting two's complement for negative numbers (wrong binary)

Why it happens: Negative in binary ≠ flip bits. -1 in 8-bit = 11111111 (two's complement: invert bits + 1). Simply flipping = wrong. -1 = NOT(00000001) + 1 = 11111110 + 1 = 11111111.

How to avoid it: Use two's complement: invert bits, add 1. Or use calculator (signed mode). -1 (8-bit) = 0xFF, -128 = 0x80 (most negative 8-bit).

Converting hex to binary digit-by-digit (wrong)

Why it happens: Hex A5: converting A → 1010, 5 → 101 = 1010101 (7 bits, wrong). Correct: 5 → 0101 (pad to 4 bits). A5 = 10100101 (8 bits). Each hex digit = exactly 4 bits.

How to avoid it: Each hex digit → 4 binary bits. Pad with leading zeros if needed: 5 → 0101, F → 1111, 0 → 0000. A5 → 1010 0101.

Using hex A-F lowercase in some contexts (case-sensitivity)

Why it happens: Hex: case-insensitive (FF = ff). But: some tools, config files case-sensitive (MAC address: AA:BB:CC = aa:bb:cc?). Hash values usually lowercase (sha256).

How to avoid it: Use consistent case: uppercase (0xFF) or lowercase (0xff). Check documentation (some tools prefer lowercase, e.g., checksums). Tool converts to both.

Assuming base 10 by default (forgetting prefixes)

Why it happens: Code: x = 077 (C/C++: octal 77 = 63 decimal, not 77). Without prefix, ambiguous. JavaScript strict mode: 077 = error. Leading 0 = octal in some languages.

How to avoid it: Always use explicit prefix: 0o77 (octal), 0x77 (hex), 77 (decimal). Or use tool to verify (input 077, see if octal or decimal). Avoid leading 0.

Frequently asked questions

Why is hex used for memory addresses?

Hex compact (1 hex digit = 4 binary bits). 32-bit address: 8 hex digits (0xDEADBEEF) vs 32 binary digits (11011110...). Easier to read, type, compare. Powers of 2 (16 = 2⁴).

How do I convert decimal to binary manually?

Divide by 2, collect remainders (reverse order). Example: 10 ÷ 2 = 5 R 0, 5 ÷ 2 = 2 R 1, 2 ÷ 2 = 1 R 0, 1 ÷ 2 = 0 R 1. Remainders: 1010 (bottom to top). 10₁₀ = 1010₂.

What is two's complement and why is it used?

Two's complement represents negative numbers in binary. Invert bits, add 1. -1 (8-bit) = NOT(00000001) + 1 = 11111111. Used: simplifies CPU arithmetic (same circuit for + and -).

Why does chmod use octal (755)?

Each octal digit = 3 binary bits (permission bits: rwx). 7 = 111 (rwx), 5 = 101 (r-x). 755 = 111 101 101 (owner, group, others). Compact, maps to permissions naturally.

Can I use hex letters A-F in lowercase?

Yes, hex case-insensitive (FF = ff). Convention: uppercase (0xFF) in code, lowercase (sha256 hashes). Tool accepts both, displays in selected case.

What is base 36 used for?

Base 36 (digits 0-9, A-Z): compact encoding (URL shorteners, compact IDs). Example: YouTube video ID (11 chars, base 64-like). Larger base = shorter representation. Max base with alphanumeric: 36.

How do I convert between binary and hex quickly?

Group binary into 4-bit chunks (nibbles). Each nibble → 1 hex digit. 1010 0101 → A5. Reverse: each hex digit → 4 bits. F → 1111, 0 → 0000. No decimal conversion needed.

References

Privacy and availability

  • Runs entirely in your browser — zero server processing
  • No signup or account required
  • Works offline once loaded
  • Fast, lightweight, no external dependencies
  • Available as a browser extension for Chrome and Firefox