Hex to Binary Converter — Hexadecimal to Base-2 Online
Convert a hex string to its binary (base-2) representation. Each hex character becomes 4 bits; output grouped as 4 bits per hex char or 8 bits per byte. Ignores '0x' prefixes and any separators automatically. 100% local.
Last updated:
CommentsPaste hex to get its binary (base-2) representation. Each hex digit is exactly 4 bits (0 → 0000, F → 1111). Group output as 4 bits per hex char or 8 bits per byte. Ignores '0x' prefixes and any separators.
What is Hex to Binary?
Hex-to-binary is a fixed 4-bit-per-digit mapping — no encoding assumption needed. This makes it a pure, unambiguous transformation, unlike text-to-binary which depends on the character encoding. The tool strips every non-hex character from the input (so '0x' prefixes, spaces, commas, newlines are all fine) then expands each hex digit to its 4-bit representation. Output grouping is your choice: 4 bits per hex char is closer to the mental model when reading hex 'digit by digit'; 8 bits per byte is closer to how the computer sees the bytes and is what most protocols document.
How to convert hex to binary online
- 1Paste hex — any format with hex digits (0-9, a-f, A-F). Separators and '0x' prefixes are ignored.
- 2Pick group size: 4 bits per hex char (finer) or 8 bits per byte (protocol-standard).
- 3Copy the output — spaces separate groups for readability.
Use Cases
Inspect flag bits in a status byte
Hex 0x4A → 0100 1010 makes it obvious which bits are set — much easier than doing math in your head.
Explain bit-level protocols
Show the bit layout of a network header, IP address, or memory-mapped register in a talk or blog post.
Debug a hash output byte-by-byte
See the actual bit pattern of a SHA-256 digest for cryptographic-property demos.
Tips & Best Practices
- ▸4-bit grouping (each hex char → 4 bits, spaced) is easiest to read when the input is short. 8-bit grouping matches how CPU / memory work — better for long inputs.
- ▸This tool is exact, not encoding-dependent. Text-to-binary goes through UTF-8 first; hex-to-binary just remaps digits.
- ▸For big-endian vs little-endian debates, the tool doesn't reorder bytes — it outputs bits in the same order as the input hex.
Frequently Asked Questions
How does hex map to binary?
Each hex digit is exactly 4 bits: 0 = 0000, 1 = 0001, …, F = 1111. So the hex byte 4A becomes 01001010 (8 bits). The tool lets you group the output as 4 bits per hex character or 8 bits per byte for readability.
Does the tool understand '0x' prefixes?
Yes — all non-hex characters (0x prefixes, spaces, commas, newlines) are stripped before conversion. So '0x4a 0x42' and '4a42' produce identical output.
Is this different from decimal-to-binary?
Yes. Decimal-to-binary interprets the input as a single number and outputs the same value in base-2. This tool works byte-by-byte — a common need when inspecting byte-level protocols, hash outputs, or memory dumps.
What happens with an odd number of hex characters?
Each hex character still becomes 4 bits — an odd count simply produces a trailing 4-bit group instead of a full byte. To force even lengths (byte-aligned), prepend a 0.
Try Next
Regex Replace
Find and replace text with a regular expression online. Supports every JavaScript flag (g, i, m, s, u, y), all backreferences ($1..$9, $&, $`, $', $<name>), and escape sequences (\n, \t) in the replacement. Live match-by-match preview and diff. 100% local.
Related Tools
Markdown → HTML
Convert Markdown to HTML with a live preview. Supports GitHub Flavored Markdown (tables, task lists, strikethrough, code fences). Free, no signup, runs entirely in your browser.
Regex Tester
Test regular expressions online with live match highlighting, capture-group and named-group output, and every JavaScript flag (g, i, m, s, u, y). Free, no signup, no ads — runs entirely in your browser.
XML Formatter
Format, beautify, and validate XML documents online. Handles namespaces, CDATA sections, and mixed content.
SQL Formatter
Format and beautify SQL queries. Supports SELECT, JOIN, subqueries, CTEs, and multiple SQL dialects.
Case Converter
Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.
Text Diff
Compare two text snippets side-by-side and highlight the differences. Word- and line-level diff, everything runs in your browser.