Skip to content
🔢

Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal. See the value in all 4 bases at once.

Share this calculator:WhatsAppTelegramX
Add this calculator to your site:
Written & reviewed by K L Hemanth KumarLast updated July 2026Formulas verified against RBI, the Income Tax Department, AMFI, and EPFO

About the Number Base Converter

Computers operate in binary (base-2), but humans prefer decimal (base-10). Hexadecimal (base-16) is used in programming for memory addresses, color codes, and low-level data representation. Octal (base-8) appears in Unix file permissions. This converter handles all common number bases and shows the step-by-step conversion - essential for computer science students and programmers working close to the hardware.

Number Base Conversion

Decimal to binary: divide repeatedly by 2, read remainders bottom-up · Binary to decimal: sum of (bit × 2^position)

Binary digits: 0, 1 · Octal digits: 0-7 · Hexadecimal: 0-9, A(10), B(11), C(12), D(13), E(14), F(15) · 1 hex digit = 4 binary digits (nibble) · FF hex = 255 decimal = 11111111 binary

Worked Example

HTML color code #FF6B35 - what are the RGB decimal values?

Hex R:FF = 15×16 + 15 = 255
Hex G:6B = 6×16 + 11 = 107
Hex B:35 = 3×16 + 5 = 53

RGB(255, 107, 53) - a vibrant orange · Binary FF = 11111111 · Binary 6B = 01101011

Tips & Insights

  • 1

    Unix file permissions 755 (octal) = 111 101 101 (binary) = read/write/execute for owner, read/execute for group and others.

  • 2

    IP addresses are 32-bit binary numbers typically shown as 4 decimal octets (192.168.1.1).

  • 3

    Hexadecimal makes binary more readable: every two hex digits = one byte = 8 bits.

  • 4

    Web colour codes (#FF5733) are hexadecimal: FF = 255 red, 57 = 87 green, 33 = 51 blue. Breaking a hex colour into its RGB components is routine for developers and designers working between design tools and code.

  • 5

    Bitwise AND is used for masking: value AND mask extracts specific bits. AND with 0xFF isolates the lowest byte of any integer.

  • 6

    XOR has a useful property: a XOR b XOR b = a. This is used in simple encryption, swap algorithms (without a temp variable), and error detection in RAID storage.

  • 7

    The number of bits required to represent N distinct values is ceil(log2(N)). For 256 values you need 8 bits (1 byte); for 1024 values you need 10 bits.

Why this matters for you

Computer science students encounter multiple number bases in every hardware and low-level programming course. Exam questions on binary, hex, and octal conversions appear regularly in BCA, B.Tech CS, and GATE CS curriculum. Understanding base conversion is not just an academic exercise - it is the foundation for reading memory dumps, interpreting protocol headers, and writing low-level device drivers.

For web developers, hex is everywhere: color codes, Unicode escape sequences, HTTP status codes, CSS transforms, and cryptographic hashes are all expressed in hexadecimal. A developer who can mentally parse #1a1a2e as a very dark navy blue, or read a SHA-256 hash without confusion, works faster and makes fewer errors than one who treats hex as mysterious.

Bitwise operations - AND, OR, XOR, and bit shifts - are the building blocks of flags, masks, permissions, and optimizations in systems programming. They appear in embedded systems (sensor bit fields), networking (subnet masks, port fields), databases (bitmap indexes), and competitive programming. Practicing conversions and bitwise logic builds the mental model needed for any role that touches hardware, networking, or performance-critical software.

Related Calculators

Frequently Asked Questions

How do you convert decimal to binary?+

Repeatedly divide by 2 and record the remainders bottom-to-top. Example: 13 / 2 = 6 R1, 6 / 2 = 3 R0, 3 / 2 = 1 R1, 1 / 2 = 0 R1 - read remainders from bottom: binary 1101. Or use this calculator instantly.

What is hexadecimal used for?+

Hexadecimal (base 16) is used extensively in computing: HTML color codes (#FF5733), memory addresses, MAC addresses, and machine code. Each hex digit represents exactly 4 binary bits (a nibble), making hex a compact binary notation.

How do you convert binary to hexadecimal?+

Group binary digits into groups of 4 from right, then convert each group to a hex digit. Example: 11010111 becomes 1101 0111 which is D7 in hex, or 0xD7. Each hex digit always maps to exactly 4 binary bits.

What is octal used for?+

Octal (base 8) is used in Unix/Linux file permissions (chmod 755 means rwxr-xr-x). Each octal digit represents 3 binary bits. Octal is less common than hex in modern computing but still appears in POSIX systems and some C language literals.

How do computers use binary and hexadecimal in everyday computing?+

Computers process everything in binary (base 2) at the hardware level. Hexadecimal (base 16) is a compact shorthand: 1 hex digit = 4 binary bits. So instead of writing 11001010 11110000 (16 digits), programmers write CA F0 (4 digits). Common uses: colour codes in web design (#FF5733 = RGB 255, 87, 51), memory addresses (0x7FFF8400), file permissions in Linux (chmod 755 = 111 101 101 binary), IPv6 addresses.

What are bitwise operations and when are they used?+

Bitwise operations work directly on binary representations of numbers. AND (&) gives 1 only when both bits are 1 - used for masking to extract specific bits. OR (|) gives 1 when either bit is 1 - used to set flags. XOR (^) gives 1 when bits differ - used in encryption, checksums, and swap-without-temp-variable algorithms. NOT (~) flips all bits. Left shift (<<1) doubles the value; right shift (>>1) halves it (integer division by 2). In embedded systems, sensors report status as individual bits in a register - bitwise operations are the standard way to read or set individual sensor flags without disturbing other bits.

How is binary used in Indian CS engineering exams like GATE?+

GATE CS has recurring questions on number base conversion, 2s complement representation, binary arithmetic, and bitwise operations. Key concepts: 2s complement of a binary number is found by flipping all bits and adding 1 - used for representing negative numbers in hardware. Range of n-bit 2s complement: -2^(n-1) to 2^(n-1) - 1. Overflow detection: signed overflow occurs when the carry into the MSB differs from carry out of MSB. Floating point (IEEE 754) uses binary for the mantissa with a biased exponent. Conversion speed using this tool lets you verify your manual conversion steps during exam preparation.