Binary Number System & Converter

Binary converter and tutorial on the binary number system. Convert between binary, decimal, hexadecimal and octal, plus text ⇄ binary (ASCII/UTF-8) with clean examples and explanations.

Choose the current literal format. Prefixes like 0b, 0x or 0o are optional.

How to use the binary toolbox

Switch between the Number bases tab (for signed or unsigned literals) and the Text ⇄ Binary tab to work with text or 8-bit binary codes. The hero controls are designed to keep the calculation process simple: type or paste a value, press Calculate, then review the results on the right-hand card. Use the Clear buttons to reset only the active tab, and the Load example buttons to start from a known value.

  • Select the input base (binary, decimal, hexadecimal, octal), type the literal, and calculate to see all common representations along with grouped binary strings.
  • On the Text tab, enter plain text or grouped binary, choose an action (Text → Binary or Binary → Text), and let the calculator render both the textual and numeric results.

The results card stays visible as you scroll, with grouped bitstrings, summary data on magnitude, and the last conversion payload ready for copying.

Full original guide (expanded)

Binary Number System & Converter

Base 2

Work comfortably with the binary number system. Convert between binary, decimal, hexadecimal, octal and text (ASCII/UTF-8), see bits grouped for readability, and review core formulas so you can reason about binary at a professional level.

Suitable for CS students, developers, embedded engineers and anyone debugging low-level data, protocols or memory layouts.

Interactive binary toolbox

Use the tabs above to convert numbers or text. The Number bases tab converts between binary, decimal, hexadecimal and octal literals, while the Text ⇄ Binary tab encodes text strings to 8-bit binary and decodes binary back to characters.

Choose the output mode, type a value, click Calculate, and the results card renders every representation plus grouping summaries for documentation or debugging.

Binary as a positional system (base 2)

Like decimal, the binary system is positional: each digit (bit) has a weight that depends on its position. In base 10 the weights are powers of 10 (1, 10, 100, …); in base 2 they are powers of 2:

For a binary number ⁠bn-1 … b1 b0 with bits bi ∈ {0,1}:

(bn-1 … b1 b0)2 = ∑i=0n-1 bi 2i.

Example: the binary number 1011012 equals

1·2⁵ + 0·2⁴ + 1·2³ + 1·2² + 0·2¹ + 1·2⁰ = 32 + 0 + 8 + 4 + 0 + 1 = 4510.

Hexadecimal and octal as compact binary

Binary is natural for machines but verbose for humans. Two derived bases are used as compact notations:

  • Hexadecimal (base 16) uses digits 0–9 and letters A–F for values 10–15. One hex digit corresponds to 4 bits.
  • Octal (base 8) uses digits 0–7. One octal digit corresponds to 3 bits.

Grouping binary digits (bits) into 4-bit nibbles or 8-bit bytes builds the mental bridge between binary and hex used in debuggers and low-level tooling.

Binary arithmetic in a nutshell

Binary arithmetic obeys the same rules as decimal, but carries occur at powers of 2:

Addition table:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 102 (write 0 and carry 1)

Higher-level operations (subtraction, multiplication, division) reduce to the same algorithms you know from decimal, but carried out bit by bit. In practice, programmers often rely on built-in integer types and bitwise operators, while using tools like this calculator to inspect and reason about binary representations.

Text and binary: bytes, codes and encodings

Computers do not “store letters”, they store bytes. A byte is typically 8 bits, which can represent integers from 0 to 255. Text encodings (ASCII, UTF-8 and others) map these integers to characters.

For example, in ASCII/UTF-8:

  • 'A' → 65 → 010000012
  • 'a' → 97 → 011000012
  • '0' → 48 → 001100002

The Text ⇄ Binary tab shows the 8-bit code for each character, which is extremely helpful when you are debugging encoding problems, serial protocols or binary file formats.

Frequently asked questions

What characters are supported in hexadecimal and octal inputs?

For hexadecimal, the converter accepts digits 0–9 and letters A–F (case insensitive). For octal, only digits 0–7 are allowed. Any underscores, spaces or common prefixes like 0x, 0X, 0o or 0b are stripped before validation.

How are negative numbers handled?

This page focuses on unsigned integers (non-negative values). If you type a leading minus sign, the converter will interpret the magnitude and attach the minus sign to all outputs. Two’s complement representation, sign bits and fixed-width integer formats are covered in specialised signed-integer tools.

Is this tool suitable for very large integers?

The implementation relies on JavaScript’s native number type, which safely represents integers up to about 9 × 1015 (253−1). Beyond that range, rounding can occur. For cryptographic or arbitrary-precision work, use a big-integer library and treat this tool as an educational aid rather than a reference implementation.

Why do some binary outputs include spaces every 4 bits?

Grouping bits into nibbles (4 bits) or bytes (8 bits) makes long binary strings much more readable and lines up neatly with hexadecimal digits. The converter shows a plain bitstring and a version grouped in 4-bit blocks so you can choose whichever is more convenient for your task.

Related Core Math & Algebra tools

Combine the binary toolbox with these calculators for a stronger foundation in discrete math and algebra.

Formulas

Binary to decimal conversion (positional form)

(bn-1 … b1 b0)2 = ∑i=0n-1 bi 2i.

1·2⁵ + 0·2⁴ + 1·2³ + 1·2² + 0·2¹ + 1·2⁰ = 32 + 0 + 8 + 4 + 0 + 1 = 4510.

Addition table:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 102 (write 0 and carry 1)
Citations

Sources (authoritative)

Changelog

Version: 0.1.0-draft — 2026-01-19

  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Version 0.1.0-draft Verified by Ugo Candido Last updated: 2026-01-19
Version 1.5.0