Skip to content
utility2026-07-253 min read

What Is Number Base Conversion

Number base conversion is the process of translating values between different numeral systems. The most commonly used bases in computer science are:

| Base | Radix | Digits | Common Usage | |------|-------|--------|-------------| | Binary | 2 | 0, 1 | Computer internals, bitwise operations | | Octal | 8 | 0-7 | Unix file permissions (chmod 755) | | Decimal | 10 | 0-9 | Everyday human counting | | Hexadecimal | 16 | 0-9, A-F | Memory addresses, color codes, hashes |

Why You Need Base Conversion

  1. Low-level debugging: Memory addresses and byte data require hexadecimal
  2. Bitwise operations: Bitmasks and shifts need binary thinking
  3. Color handling: CSS colors use hex (#FF5733)
  4. Network configuration: Subnet masks involve binary-decimal conversion
  5. File permissions: Linux permissions use octal (chmod 755)
  6. Encoding debugging: Base64 and URL encoding involve hex at the low level

Base Conversion Methods

Manual Conversion Techniques

Decimal → Binary (divide by 2, collect remainders):

13 ÷ 2 = 6 remainder 1
 6 ÷ 2 = 3 remainder 0
 3 ÷ 2 = 1 remainder 1
 1 ÷ 2 = 0 remainder 1
Result: 1101

Decimal → Hexadecimal (divide by 16, collect remainders):

255 ÷ 16 = 15 remainder 15 (F)
 15 ÷ 16 = 0  remainder 15 (F)
Result: FF

Programming Language Conversion

JavaScript / TypeScript:

const num = 255;

num.toString(2)   // "11111111" (binary)
num.toString(8)   // "377" (octal)
num.toString(10)  // "255" (decimal)
num.toString(16)  // "ff" (hex)

// String → Number
parseInt("ff", 16)      // 255
parseInt("11111111", 2) // 255

Python:

num = 255

bin(num)  # "0b11111111"
oct(num)  # "0o377"
hex(num)  # "0xff"

# String → Number
int("ff", 16)      # 255
int("11111111", 2) # 255

Go:

import "strconv"

num := 255

strconv.FormatInt(int64(num), 2)   // "11111111"
strconv.FormatInt(int64(num), 8)   // "377"
strconv.FormatInt(int64(num), 16)  // "ff"

// String → Number
strconv.ParseInt("ff", 16, 64)      // 255
strconv.ParseInt("11111111", 2, 64) // 255

How to Use an Online Number Base Converter

Using DevToolkit Pro's Number Base Converter:

  1. Enter a value in any base
  2. Select the input base (2/8/10/16)
  3. See all base conversions instantly
  4. One-click copy for any format

Quick Reference Table

| Decimal | Binary | Octal | Hexadecimal | |---------|--------|-------|-------------| | 0 | 0000 | 0 | 0 | | 1 | 0001 | 1 | 1 | | 8 | 1000 | 10 | 8 | | 10 | 1010 | 12 | A | | 16 | 10000 | 20 | 10 | | 64 | 1000000 | 100 | 40 | | 128 | 10000000 | 200 | 80 | | 255 | 11111111 | 377 | FF |

FAQ

Why Do Programmers Prefer Hexadecimal?

Hex is a human-friendly shorthand for binary. 1 hex digit = 4 binary digits, so 0xFF directly maps to 11111111. Hex is more intuitive than decimal when representing bytes and memory addresses.

Is Octal Still Relevant?

Primarily for Linux file permissions. chmod 755 uses octal: 7=rwx, 5=r-x. Also used for escape sequences in some languages (\012 = newline).

How to Quickly Convert Binary to Hex?

Every 4 binary digits map to 1 hex digit. Group right-to-left: 1111 1111F FFF. This is a direct mapping in computer hardware.


This article is brought to you by DevToolkit Pro. More developer tools at the homepage.


ad