Number Base Converter
Convert instantly between Binary, Octal, Decimal and Hexadecimal — with step-by-step workings, 2s complement signed integers, IEEE 754 float preview, colour-coded nibbles, copy-as-code literals and batch mode. The most complete free base converter for developers and students.
Number Base Converter Tool
Enter one number per line in the input area. Select the source base and the target base, then click Convert All. Results appear in the output area with the converted value on each line.
Rate this tool
The most complete free number base converter for developers and students
Every other free base converter is a bare-bones four-field input. This one adds step-by-step workings, 2s complement, IEEE 754 float preview, colour-coded nibble groups, copy-as-code literals and batch mode — features that are scattered across paid tools or simply absent online.
How to use the Number Base Converter
1010 1111) — they are stripped automatically. Hex accepts both uppercase (AF) and lowercase (af).0b10101111). The chip turns green briefly to confirm the copy.How this base converter compares
| Feature | LazyTools ✦ | RapidTables | Browserling | binaryhexconverter.com |
|---|---|---|---|---|
| Binary ↔ Octal ↔ Decimal ↔ Hex | ✔ All 4 | ✔ All 4 | ✔ Most | ✔ All 4 |
| Step-by-step workings shown | ✔ Full steps | ✔ Partial | ✘ No | ✘ No |
| Colour-coded nibble groups | ✔ Yes | ✘ No | ✘ No | ✘ No |
| 2s complement signed integers | ✔ 8/16/32-bit | ✔ Separate page | ✘ No | ✘ No |
| IEEE 754 float preview | ✔ 32-bit | ✘ No | ✘ No | ✘ No |
| Copy as code literal (Python, C, JS…) | ✔ 6 formats | ✘ No | ✘ No | ✘ No |
| Batch conversion mode | ✔ Yes | ✘ No | ✔ Some | ✘ No |
| Bit-width selector (4/8/16/32/64) | ✔ Yes | ✘ No | ✘ No | ✘ No |
| Input validation with error messages | ✔ Inline | Silent | Silent | Silent |
| No ads or pop-ups blocking the tool | ✔ Clean | Heavy ads | Ads | Heavy ads |
Binary, Octal, Decimal and Hex reference — 0 to 255
| Decimal | Binary | Octal | Hex | Character (ASCII) |
|---|
Number Systems Explained — Binary, Octal, Decimal and Hexadecimal for Developers and Students
Every digital computer ultimately works in binary — sequences of 0s and 1s representing the off and on states of billions of transistors. But working directly with long binary strings is impractical for human programmers, which is why octal and hexadecimal number systems were developed as shorthand representations of binary data. Understanding how to convert between binary, octal, decimal and hexadecimal is a foundational skill in computer science, embedded systems development, network engineering, digital electronics and computer architecture.
The decimal number system (base 10)
Decimal is the number system humans use in everyday life. It uses ten symbols (0–9) and is a positional system where each digit's value is determined by its position multiplied by a power of 10. The number 347 means 3 × 10² + 4 × 10¹ + 7 × 10⁰ = 300 + 40 + 7. Decimal is the native language of human arithmetic but is not directly used by digital hardware, which fundamentally operates on binary signals.
The binary number system (base 2)
Binary uses only two symbols — 0 and 1 — and each position represents a power of 2. For example, 1011 in binary means 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰ = 8 + 0 + 2 + 1 = 11 in decimal. This base-2 system is the language of digital logic because electronic circuits are most reliably built to distinguish between two states (high and low voltage). Every piece of data in a computer — text, images, programs, network packets — is ultimately stored and processed as binary. An 8-bit group of binary digits is called a byte, and bytes are the fundamental unit of digital data storage.
The hexadecimal number system (base 16)
Hexadecimal uses 16 symbols: the digits 0–9 plus the letters A–F representing values 10–15. Each hex digit maps exactly to a 4-bit binary nibble, making it extremely convenient for reading binary data. The conversion between hex and binary requires no arithmetic — you simply substitute each hex digit with its 4-bit binary equivalent. For example, the hex value AF converts to binary 1010 1111 (A = 1010, F = 1111). Hexadecimal is used pervasively in computing for memory addresses (0x7FFF0000), colour codes in CSS (#FF5733), network MAC addresses (00:1A:2B:3C:4D:5E), byte-level data in hex editors, and assembly language programming.
The octal number system (base 8)
Octal uses digits 0–7, and each octal digit maps to exactly 3 binary bits. Octal was more commonly used in early computing — systems like the PDP-8 and various early Unix systems used it extensively. Today its most visible use is in Unix file permissions: the permission chmod 755 sets permissions as octal 7 (rwx = 111), 5 (r-x = 101), 5 (r-x = 101). Octal is less commonly encountered than hexadecimal in modern programming but remains relevant in Unix system administration and some embedded system contexts.
How to convert binary to decimal — step by step
Write the binary number with position indices starting at 0 on the right. Multiply each binary digit by 2 raised to the power of its position index, then sum all the results. For binary 10110101: 1×2⁷ + 0×2⁶ + 1×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 0×2¹ + 1×2⁰ = 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181. The LazyTools converter shows this complete positional expansion for every binary input.
What is 2s complement and why does it matter?
2s complement is the standard method computers use to represent negative integers. Without a signed representation scheme, a binary pattern like 11111111 in 8-bit would be ambiguous — it could mean either 255 (unsigned) or −1 (signed 2s complement). In 2s complement, the most significant bit (MSB) acts as a sign bit: 0 means positive, 1 means negative. To negate a number in 2s complement, invert all bits (creating the 1s complement) then add 1. The 2s complement of 00000101 (+5) is 11111010 + 1 = 11111011, which represents −5 in signed 8-bit. This scheme is used because it allows subtraction to be implemented using the same adder circuit as addition — a major hardware simplification. The 8-bit signed range is −128 to +127; the 16-bit range is −32,768 to +32,767; the 32-bit range is −2,147,483,648 to +2,147,483,647.
IEEE 754 floating point — how computers represent decimals
Integers are straightforward in binary, but representing numbers with decimal fractions requires a different scheme. The IEEE 754 standard defines how floating-point numbers are stored using three components: a sign bit (0 = positive, 1 = negative), a biased exponent field (8 bits in 32-bit single precision, bias of 127), and a mantissa or significand (23 bits in 32-bit). The formula for decoding is: value = (−1)^sign × 2^(exponent − 127) × (1 + mantissa). Special cases include zero (all bits zero), infinity (exponent all 1s, mantissa zero) and NaN — Not a Number (exponent all 1s, mantissa non-zero). Understanding IEEE 754 is critical for anyone working in scientific computing, graphics programming, embedded systems or numerical analysis.
Common conversions for developers
Developers frequently need base conversions in several specific contexts. CSS colour codes use 6 hex digits representing three bytes for red, green and blue channels — #FF5733 is red=255 (0xFF), green=87 (0x57), blue=51 (0x33). Network IP addresses in binary are important for understanding subnetting — the IP 192.168.1.1 in binary is 11000000.10101000.00000001.00000001. Memory addresses in debuggers and assembly are nearly always shown in hexadecimal. Bitmask operations in C and embedded programming use binary or hex representations of flag values. Character encoding in ASCII maps directly to decimal values 0–127, each corresponding to a unique binary pattern.
Number base prefixes in programming languages
Every major programming language has a standard notation for expressing integer literals in different bases directly in source code. In Python 3, binary literals use the 0b prefix (e.g., 0b10101111), octal uses 0o (e.g., 0o257), and hex uses 0x (e.g., 0xAF) — all three evaluate to decimal 175. In C and C++, hex uses 0x, octal uses a leading zero (0257), and binary literals were added in C++14 with 0b. JavaScript supports 0b, 0o and 0x in modern ES6. Assembly language typically uses a trailing h suffix for hex (e.g., 0AFh). Understanding these prefixes is important when reading code across languages and copying values between tools and source files. This converter's copy-as-code literals panel generates the correct syntax for Python, C, JavaScript and Assembly automatically.
Bit manipulation and bitmask operations
One of the most practical applications of binary and hexadecimal in programming is bitwise operations and bitmask patterns. A bitmask is a value where specific bits are set to 1 to indicate which flags or options are active. For example, in Unix file permissions, binary 10101101 (hex 0xAD) has bits set corresponding to read, write and execute permissions for owner, group and others. Bitwise AND tests whether a specific bit is set, bitwise OR sets a bit, bitwise XOR toggles a bit, and bitwise NOT inverts all bits. Working with bitmasks almost always requires converting between binary (to see which bits are set) and hex (for compact notation in code). The colour-coded nibble display in this converter groups bits into visually distinct 4-bit sections specifically to make bitwise analysis easier — each coloured nibble maps directly to a single hex digit, letting you instantly read which bits are active in any byte-level value.