8 in binary, octal and hexadecimal

    Convert numbers between decimal (DEC), binary (BIN), octal (OCT) and hexadecimal (HEX). Type a number in any base and get all four representations instantly.

    The decimal number 8 converted into the three bases that matter in computing: binary, octal and hexadecimal. The working is shown rather than just the answer, so this doubles as a way of checking your own conversion by hand. Type a different number below, or switch the input system to convert the other way round.

    Parameters

    Enter data for calculations

    Number system of the input value

    Enter a number in the selected system

    Form progress0 / 2 fields

    💡 Fill in all required fields to unlock the calculate button

    Number System Converter - before you calculate

    Without converter

    • Manual division by 2/8/16 - easy to make mistakes
    • Mix up remainder order in BIN conversion
    • Forget hex digit values A-F
    • Waste time on CS assignments

    With converter

    • Type a number, pick a system - done
    • DEC, BIN, OCT, HEX all at once
    • Verify manual calculations
    • Result in a fraction of a second

    How does the conversion work?

    DEC (decimal) - digits 0-9, base 10
    BIN (binary) - digits 0-1, base 2
    OCT (octal) - digits 0-7, base 8
    HEX (hexadecimal) - digits 0-9 + A-F, base 16
    DEC 42 to BIN: 42 / 2 = 21 r 0, 21 / 2 = 10 r 1, 10 / 2 = 5 r 0, 5 / 2 = 2 r 1, 2 / 2 = 1 r 0, 1 / 2 = 0 r 1. Read from bottom: 101010
    DEC 255 to HEX: 255 / 16 = 15 r 15 (F), 15 / 16 = 0 r 15 (F). Result: FF
    BIN 11001 to DEC: 1x16 + 1x8 + 0x4 + 0x2 + 1x1 = 25

    Conversion table - common values

    DEC BIN OCT HEX IT context
    0 0 0 0 NULL, false
    10 1010 12 A -
    127 1111111 177 7F Max signed byte (int8)
    255 11111111 377 FF Max unsigned byte, RGB color channel
    1024 10000000000 2000 400 1 KB (kibibyte)
    65535 1111111111111111 177777 FFFF Max uint16, TCP port range

    Practical examples

    CSS color #FF5733: Split into pairs - FF = 255 (Red), 57 = 87 (Green), 33 = 51 (Blue). So #FF5733 = rgb(255, 87, 51) - an orange-red.
    Each hex pair converts to a 0-255 decimal value
    Linux chmod 755: Octal 755 = binary 111 101 101 = rwx r-x r-x. Owner gets read+write+execute, group and others get read+execute only.
    Each octal digit maps to exactly 3 permission bits
    IP address 192.168.1.1: Each octet in decimal. 192 = binary 11000000, 168 = 10101000. The full address in binary: 11000000.10101000.00000001.00000001 (32 bits).
    Understanding subnet masks requires binary thinking
    Memory address 0x7FFF: Hex 7FFF = decimal 32767 = binary 111111111111111. This is the maximum value of a signed 16-bit integer (int16).
    Memory addresses are almost always displayed in hex
    ASCII character 'A': Decimal 65 = hex 41 = binary 1000001 = octal 101. Every character in a text file has a numeric code - the converter shows all representations at once.
    ASCII table values appear in all four number systems

    HEX in CSS colors

    Color HEX RGB (DEC) BIN (R channel)
    Red #FF0000 255, 0, 0 11111111
    Green #00FF00 0, 255, 0 00000000
    White #FFFFFF 255, 255, 255 11111111
    Teal #14B8A6 20, 184, 166 00010100

    FAQ - Frequently Asked Questions

    What is binary used for?
    Computers operate on bits (0 and 1) - it is the only thing a processor understands. Every operation, text, image is ultimately a sequence of zeros and ones. 8 bits = 1 byte = a number from 0 to 255.
    Why do programmers use hexadecimal?
    HEX is a shorthand for binary - 1 hex digit = 4 bits. A byte (8 bits) is exactly 2 hex digits. Instead of writing 11111111 you write FF. That is why CSS colors (#FF0000), MAC addresses and memory dumps use hex notation.
    How do I convert BIN to DEC manually?
    Multiply each digit by its corresponding power of 2 (from right: 1, 2, 4, 8, 16...) and sum. For example, 1101 = 1x8 + 1x4 + 0x2 + 1x1 = 13.
    What do the letters A-F mean in hex?
    A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. The hexadecimal system needs 16 digits but we only have 10 (0-9), so it adds letters A through F for values 10-15.
    When is the octal system used?
    Mainly in Linux/Unix for file permissions (chmod). 755 = rwxr-xr-x, 644 = rw-r--r--. Each octal digit represents 3 bits, so 3 digits = 9 permission bits (owner/group/others).
    How does the CSS color #FF5733 translate to RGB?
    Split into pairs: FF = 255 (R), 57 = 87 (G), 33 = 51 (B). So #FF5733 = rgb(255, 87, 51) - an orange-red tone. The converter will turn each hex pair into its decimal equivalent.

    Related tools

    Powers & Roots Calculator

    Powers of 2 are the foundation of number systems - Open calculator

    Logarithm Calculator

    Log2 tells you how many bits are needed to represent a number - Open calculator

    Percentage Calculator

    Calculate percentages, increases, decreases and ratios - Open calculator

    GCD & LCM Calculator

    Greatest common divisor and least common multiple - Open calculator

    Average Calculator

    Arithmetic, geometric, harmonic and weighted mean - Open calculator

    Calculator verified by the LiczGrupa.pl team

    Content, formulas and results have been reviewed for accuracy and relevance by our team of specialists.

    Krystian Szyszka

    Reviewed by: Krystian Szyszka