HomeFormattersCodeBinary / Hex Converter & Formatter

Binary / Hex Converter & Formatter

Code

Convert between binary, hexadecimal, decimal, octal, and ASCII text instantly. Accepts space-separated or continuous input — client-side, no data sent.

What is a Binary/Hex?

The Binary / Hex Formatter converts values between binary, hexadecimal, decimal, octal, and ASCII text — the five representations of integer byte values used across computing, networking, and data engineering. It accepts space-separated tokens in any of those formats and renders the same values in your chosen output format, with configurable separators.

These conversions come up constantly in technical work: hex dumps from network traffic analysis need to be decoded as ASCII to read protocol messages; binary values from embedded systems need to be shown as hex for memory address comparisons; ASCII text needs to be expressed as decimal byte values for certain encoding or encryption implementations.

Five input formats, five output formats — any combination:

  • Hexadecimal (0–9, A–F): the most common format for byte dumps, colour codes, hashes, and binary file inspection
  • Binary (0 and 1): machine-level bit patterns; 8 bits per byte
  • Decimal (0–255 for byte values): direct integer values
  • Octal (0–7): legacy Unix file permissions, older protocol specifications
  • ASCII Text: human-readable characters mapped to their code point values

All conversion is client-side. Input is never transmitted or stored. Use the Base64 Formatter for Base64 encoding/decoding, or the URL Encoder / Decoder for percent-encoding.

How to use this Binary/Hex calculator

  1. Enter your input in the 'Input' textarea — space-separated tokens, or plain text for ASCII input.
  2. Select the input format — Hexadecimal (most common), Binary, Decimal, Octal, or ASCII Text.
  3. Select the output format — ASCII Text to read a hex dump, Hexadecimal to encode binary or text, etc.
  4. Select the output separator — Space for readability, None for continuous output (hash strings), Comma for CSV, Newline for one value per line.
  5. Read the output instantly — the conversion applies on every change.
  6. Click the copy button to copy the converted values.

Formula & Methodology

Parsing algorithm:
1. Split input by whitespace and commas into individual tokens.
2. For each token, strip any 0x prefix, then parse using parseInt(token, base) for the selected base.
3. Return the integer byte value for each token.

Rendering algorithm:
1. For ASCII Text output: String.fromCharCode(value) for each integer, joined with no separator.
2. For all other outputs: convert each integer using .toString(base), pad to 2 chars for hex, pad to 8 bits for binary, then join with the chosen separator.

Before/after example:

| Input | From | To | Output |
|---|---|---|---|
| 48 65 6C 6C 6F | Hex | ASCII | Hello |
| Hello | ASCII | Hex | 48 65 6C 6C 6F |
| Hello | ASCII | Binary | 01001000 01100101 01101100 01101100 01101111 |
| 72 101 108 | Decimal | Hex | 48 65 6C |
| 01001000 | Binary | Decimal | 72 |

Frequently Asked Questions

Hexadecimal (hex) is a base-16 number system using digits 0–9 and letters A–F. It is used in computing because each hex digit represents exactly 4 bits, making it compact and directly mappable to binary. A byte (8 bits) is always exactly 2 hex digits: the byte value 255 is 0xFF, 72 is 0x48. Memory addresses, colour codes (#FF5733), SHA hashes, and binary file dumps are all displayed in hex because it is more readable than long binary strings.
Select 'Hexadecimal' as the input format and 'ASCII Text' as the output format. Enter hex bytes separated by spaces (e.g. '48 65 6C 6C 6F'). The formatter converts each hex pair to its ASCII character value — 0x48=H, 0x65=e, 0x6C=l, 0x6C=l, 0x6F=o — and joins them into readable text. This is the most common use case: reading hex dumps from network packets, binary files, or database BLOB fields.
Select 'ASCII Text' as the input format and 'Binary' as the output format. Type or paste your text and each character is converted to its 8-bit binary representation. The letter 'H' (ASCII 72) becomes '01001000'; the space character (ASCII 32) becomes '00100000'. Use 'Newline' as the output separator to see one 8-bit value per line.
These are all ways of writing the same underlying integer values using different bases. Binary (base 2) uses only 0 and 1 — every value is a string of bits. Octal (base 8) uses digits 0–7 and was common in older Unix systems. Decimal (base 10) is the everyday number system. Hexadecimal (base 16) uses 0–9 and A–F. The byte value 255 is 11111111 in binary, 377 in octal, 255 in decimal, and FF in hex.
Choose 'Space' for readability (48 65 6C 6C 6F), 'None' for continuous output (48656C6C6F) which is the standard format for hash strings and file checksums, 'Comma' for CSV compatibility (48, 65, 6C), and 'Newline' for one value per line. When converting to ASCII text, the separator setting is ignored — characters are simply joined without separators.
Yes — select 'Binary' as the input format and 'Hexadecimal' as the output. Enter binary values space-separated (e.g. '01001000 01100101'). Each 8-bit binary value is converted to its 2-digit hex equivalent — 01001000 = 48, 01100101 = 65. The output uses uppercase hex digits padded to 2 characters.
No — all conversion happens entirely in your browser using client-side JavaScript. Input is never sent to any server or stored. The tool works offline once the page is loaded. This matters when you are examining sensitive binary data — encryption keys, credentials in hex format, private file headers — that you do not want transmitted through a web service.
This formatter uses uppercase hex (FF, A3, 5C) for consistency with the most common convention in technical documentation, memory dumps, and network protocol analysis. Both cases are valid hex — a parser accepts A3 and a3 equally. If you need lowercase output for a specific use case (e.g. CSS colour codes or some hash comparison), convert the output manually after copying.
Enter your input in the 'Input' textarea. Select the input format — Hexadecimal, Binary, Decimal, Octal, or ASCII Text. Select the output format. Choose an output separator. The converted output appears instantly. For hex-to-text conversion: paste hex bytes space-separated, select Hex input and ASCII Text output, and the human-readable string appears immediately.
The '0x' prefix is a programming convention (used in C, Python, JavaScript, etc.) to indicate that the following digits are hexadecimal. For example, 0xFF = 255 in decimal. The formatter accepts input with or without the 0x prefix — it strips non-hex characters from each token before parsing. The output does not include 0x, producing clean hex strings suitable for most use cases.
No — Base64 and URL encoding are different encoding schemes, not number base conversions. This formatter handles the four standard numeric bases (binary, octal, decimal, hex) and ASCII text conversion. For Base64 encoding and decoding, use the [Base64 Formatter](/base64-formatter/). For URL encoding and decoding, use the [URL Encoder / Decoder](/url-encoder-formatter/).
Also known as
binary to hexhex to binaryhex to asciibinary to textdecimal to hexnumber base converter