Binary / Decimal / Hex / Octal Converter & Bit Visualizer

Use this interactive number base converter to move between binary, decimal, hexadecimal, and octal, and see how each bit contributes to the value. It is designed as a teaching tool for computer science students learning how number systems and bits work.

Binary / Decimal / Hex / Octal Converter

Enter a value in any base to see it update instantly in binary, decimal, hexadecimal, and octal. Everything runs locally in your browser and is designed for computer science students learning number systems.

Digits 0–9 only.

Digits 0–1 only.

Digits 0–9 and letters A–F.

Digits 0–7 only.

Quick examples

Bit visualizer

View how this value fits into 8, 16, or 32 bits. Each highlighted bit contributes a power of two to the total.

Bit width:
Value (clamped): 0Binary (8 bits): 00000000
27
26
25
24
23
22
21
20

Place value table

See how each digit in binary, decimal, hex, or octal expands into powers of its base and contributes to the total value.

Base:
Position (from right)DigitPlace valueContribution
0020 = 10

Understanding binary, decimal, hex, and octal number systems

Modern computers store and process everything as bits, but people still think in decimal most of the time. A good binary to decimal converter bridges this gap and helps you see how the same integer can be written in different number bases. Decimal (base 10) uses digits 0–9; binary (base 2) uses just 0 and 1; octal (base 8) uses 0–7; and hexadecimal, or hex (base 16), uses 0–9 plus A–F. Each system is just a different way to write the same quantity, and understanding their relationships is essential for computer science students.

What is the binary number system?

The binary number system is base 2, which means each digit represents a power of two instead of a power of ten. The right most bit is 2⁰ = 1, the next is 2¹ = 2, then 2² = 4, 2³ = 8, and so on. To convert binary to decimal, you add up the place values of all the bits that are set to 1. For example, the binary value 101010 is 32 + 8 + 2 = 42 in decimal.

The bit visualizer in this tool shows each bit as a small square labeled with its power of two. You can see at a glance which bits are set and how they combine to produce the total. This makes decimal to binary conversions feel less abstract, because you can literally see the powers of two lighting up instead of just trusting a calculator.

How hexadecimal and octal relate to binary

Hexadecimal and octal are convenient “shorthand” for binary. In hex, each digit corresponds to exactly four bits (a nibble), because 2⁴ = 16. In octal, each digit corresponds to three bits, because 2³ = 8. This is why it is common to group binary digits into chunks of 4 when converting to hex, or chunks of 3 when converting to octal. A hexadecimal to binary conversion is often just a matter of mapping each hex digit to its 4-bit binary equivalent.

The converter on this page always shows hex values in uppercase and keeps the binary representation padded to your chosen bit width (8/16/32 bits). This makes the relationship between groups of 4 bits and hex digits very explicit, especially when you experiment with quick examples like 255 (all 8 bits set) or 4095 (12 bits set).

Place values and powers of two

Every positional number system is built on place values. In decimal, the columns from right to left are 1, 10, 100, 1000, and so on. In binary, the columns are 1, 2, 4, 8, 16, 32, and so forth. In hex, the columns are 1, 16, 256, 4096, and so on. The place value table in this number base converter shows exactly how each digit (whether in binary, decimal, hex, or octal) multiplies a power of its base and contributes to the total.

For example, in decimal, the value 1234 breaks down into 1×10³ + 2×10² + 3×10¹ + 4×10⁰. In binary, a value like 101101 becomes 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰. Seeing these decompositions written out in a table helps reinforce why powers of two, powers of ten, and powers of sixteen matter in different contexts—from low-level machine code to human-friendly displays.

How to use this binary, decimal, hex, and octal converter

To use the converter, type a value into any of the four input fields: decimal, binary, hexadecimal, or octal. The tool validates the digits according to the selected base and updates the other three fields in real time whenever the input is valid. This lets you treat it as a binary to decimal converter, a decimal to hex converter, an octal to decimal converter, or any other combination without switching modes.

Below the inputs, the bit visualizer shows the value in 8, 16, or 32 bits. You can change the bit width to see how the same integer is represented in different-sized registers. Hovering over a bit explains which power of two it represents and whether it is contributing to the value. Further down, the place value table lets you drill into binary, decimal, hex, or octal expansions in more detail, which is especially useful when you are first learning positional notation.

Why CS students need to know these number bases

Understanding binary, hex, and octal is a core part of computer science, systems programming, and hardware design. Memory addresses, machine instructions, bitmasks, and many networking values are commonly shown in hex. File permissions on Unix systems are specified in octal. Binary shows up when you are designing logic gates, working with bit-level operations, or analyzing protocol fields.

Tools like this converter and bit visualizer are meant to bridge the gap between abstract theory and concrete values. As you work through exercises or debug code, you can keep this page open to quickly sanity-check conversions or to understand how a specific bit pattern maps to decimal. It pairs nicely with other math and CS tools in LifeHackToolbox, such as the Unit Circle Calculator for trigonometry, the Universal Unit Converter for everyday calculations, and the DNA Sequence Explorer for exploring patterns in biological sequences. Together, these tools form a practical, browser-based toolkit for students across math, science, and computer science.