Online Tools Center
  • Home
  • Tools
  • Converters
Online Tools Center

Free online calculators for math, finance, fitness, and more.

Quick Links

  • Math Calculators
  • Tools
  • Converters
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Online Tools Center. All rights reserved.

Binary Converter

Instantly convert between decimal, binary, octal and hexadecimal number systems with two's complement support.

Number Base Converter

Valid range (signed): -128 to 127

Enter a value in any field to convert

What Is a Binary Converter?

A binary converter translates numbers between the positional number systems computers use internally. The four most common bases are decimal (base-10, used by humans), binary (base-2, used by computers), octal (base-8, used in Unix file permissions) and hexadecimal (base-16, used in colour codes and memory addresses).

Understanding these systems is fundamental to computer science, digital electronics and low-level programming. Every file, image and network address ultimately boils down to sequences of 0s and 1s.

Conversion Formulas

The value of any number in a positional system is the sum of each digit multiplied by the base raised to the power of its position.

Positional Notation (base-N to decimal)

N=∑i=0n−1bi⋅2iN = \sum_{i=0}^{n-1} b_i \cdot 2^iN=i=0∑n−1​bi​⋅2i
e.g. 10112=1⋅23+0⋅22+1⋅21+1⋅20=1110\text{e.g.}\ 1011_2 = 1 \cdot 2^3 + 0 \cdot 2^2 + 1 \cdot 2^1 + 1 \cdot 2^0 = 11_{10}e.g. 10112​=1⋅23+0⋅22+1⋅21+1⋅20=1110​

Two's Complement (negative numbers)

−N=N‾+1(mod2n)-N = \overline{N} + 1 \pmod{2^n}−N=N+1(mod2n)
e.g. −510→8-bit1111 10112=FB16\text{e.g.}\ -5_{10} \xrightarrow{8\text{-bit}} 1111\,1011_2 = \text{FB}_{16}e.g. −510​8-bit​111110112​=FB16​

For two's complement, invert all bits and add 1 to obtain the negative representation within a fixed bit width. This allows the same arithmetic hardware to handle both positive and negative numbers.

Practical Examples

ASCII Character 'A'

The letter 'A' has ASCII code 65. In 8-bit binary: 0100 0001. In hex: 0x41. In octal: 101. Knowing this mapping is essential for low-level text processing.

IPv4 Subnet Mask

The common subnet mask 255.255.255.0 means each octet is 1111 1111 in binary. The CIDR notation /24 refers to the 24 leading 1-bits that define the network portion.

TCP Port 80

HTTP traffic uses TCP port 80, which is 0101 0000 in 8-bit binary and 50 in hex. Firewall rules and packet filters often work directly at the binary or hex level.

8-bit Colour Channel

A single RGB channel stores values 0–255. Pure red in CSS is #FF0000, where FF is 1111 1111 in binary — the maximum value for an 8-bit field.

How the Converter Works

  1. 1

    Type or paste a value in any of the four input fields (decimal, binary, octal or hexadecimal).

  2. 2

    Select the bit width that matches your target system (e.g. 8-bit for a byte, 32-bit for a typical integer).

  3. 3

    The converter parses your input for the chosen base, validating digits and the signed range.

  4. 4

    The decimal equivalent is derived, then re-expressed in all other bases simultaneously.

  5. 5

    Negative decimals are shown in two's complement binary for the selected bit width, with the corresponding octal and hex values.

Tips and Tricks

  • ✦Group binary digits into nibbles (4-bit chunks) from the right — each nibble maps to exactly one hex digit, making conversion fast.
  • ✦Use the 8-bit mode when working with bytes, ASCII characters or individual colour channels.
  • ✦Three binary digits correspond to one octal digit. This made octal popular in pre-hex computing and Unix permissions (e.g. chmod 755).
  • ✦For 32-bit signed integers the range is −2,147,483,648 to 2,147,483,647 — a quirk relevant when choosing integer types in C, Java or Rust.
  • ✦Hex is case-insensitive — 0xFF and 0xff mean the same value. Most style guides prefer uppercase for memory addresses and lowercase for CSS colours.

Frequently Asked Questions

Why do computers use binary instead of decimal?▼

Digital hardware is built from transistors that switch between two stable states (on/off, high/low voltage). Representing these two states as 1 and 0 is simple and reliable. Decimal would require ten stable states per digit, which is far harder to implement in silicon.

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

Two's complement is the standard method for encoding negative integers in binary. To negate a number, invert all its bits and add 1. Its key advantage is that addition hardware works identically for positive and negative numbers, so CPUs do not need separate subtraction circuits.

How do I convert binary to hexadecimal quickly?▼

Group the binary digits into nibbles of four from the right, padding with leading zeros if needed. Each nibble maps directly to a single hex digit: 0000=0, 0001=1, …, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F.

What is the difference between signed and unsigned binary?▼

Unsigned binary treats all bits as magnitude, giving a range of 0 to 2ⁿ−1. Signed binary (two's complement) reserves the most significant bit as a sign bit, giving a range of −2ⁿ⁻¹ to 2ⁿ⁻¹−1. This converter uses the signed interpretation.

Why is hexadecimal preferred over binary in programming?▼

A byte (8 bits) is always exactly two hex digits, making hex far more compact and readable than long binary strings. Memory dumps, colour codes (#RRGGBB) and bitfield masks are all conventionally written in hex.

What does 'bit width' mean in this converter?▼

Bit width determines how many binary digits represent a number and defines the valid signed range. An 8-bit field holds one byte (range −128 to 127). A 16-bit field holds two bytes (range −32,768 to 32,767). Choosing the correct width avoids overflow errors in your code.

Rate This Calculator