Binary/Hex Converter

Convert numbers between binary, hex, decimal, and octal — or turn text into bytes.

Ready. Type a number or some text to convert.

Every conversion runs in your browser. Your numbers and text never leave your device.

FAQ

What can I convert here?

Two things. Number mode links binary, octal, decimal, and hexadecimal — edit any one field and the rest update instantly. Text mode turns any text into its byte values in the base you pick, and reads those bytes back into text.

Does it handle negative and very large numbers?

Yes. Negatives keep a leading minus in every base, and there is no size limit worth worrying about — values convert exactly, with no rounding. There is no fixed-width two’s-complement view, since that only makes sense once you pick a bit width.

Is my input sent anywhere?

No. Everything is computed locally in your browser, so nothing you type is uploaded.

Multi-Base Number Conversion

This tool converts numbers between binary, octal, decimal, and hexadecimal formats. When working in Number mode, editing any one of these fields instantly updates the other three.

The converter supports arbitrary precision integers up to 4,096 characters using BigInt. Because of this, there is no practical size limit for numbers, and all values convert exactly with no rounding.

Input Formatting and Syntax Rules

To accommodate different notation styles, the tool accepts several formatting variations in the input fields:

  • Prefixes: You can include standard programming prefixes such as 0b for binary, 0o for octal, and 0x for hexadecimal.
  • Separators: Underscores and whitespace separators are permitted within the input to make long numbers easier to read.
  • Negative Numbers: Negative numbers retain a leading minus sign in every base. The tool does not use a fixed-width two’s-complement representation, as that representation requires choosing a specific bit width.
  • Spaces: Surrounding spaces around the input do not affect the conversion.

If you enter a character that is not permitted in the selected base, the tool displays the error message: "Not a valid number for that base — check for digits it can’t contain." When a conversion is successful, the status updates to "Converted." Clearing the input resets the status to "Cleared."


Text and Byte Encoding

In Text mode, the tool converts text into its corresponding byte values in a chosen base, or decodes those byte values back into text. The supported bases for byte representation are binary, octal, decimal, and hexadecimal.

+-------------------------------------------------------------------+
|                             Text Mode                             |
+--------------------------------+----------------------------------+
| Text -> Bytes (Encoding)       | Bytes -> Text (Decoding)         |
| Converts text to byte values   | Converts byte values to text     |
| Max input: 200,000 characters  | Rejects non-UTF-8 byte streams   |
+--------------------------------+----------------------------------+

Text to Bytes (Encoding)

When converting text to bytes, the tool encodes the input text using UTF-8. The maximum length for the text input is 200,000 characters. If this limit is exceeded, the tool displays the error: "That’s too long for this tool — try a shorter input."

The output format of the byte values depends on the chosen base, with specific padding rules applied to ensure consistent width:

  • Binary: Padded with leading zeros to 8 bits.
  • Octal: Padded with leading zeros to 3 bits.
  • Hexadecimal: Padded with leading zeros to 2 bits and uses uppercase letters.
  • Decimal: Output is not padded with leading zeros.

Upon successful encoding, the status displays "Encoded."

Bytes to Text (Decoding)

When decoding byte values back into text, the input bytes can be separated by whitespace or commas. Each value must represent exactly one byte, meaning it must fall within the range of 0–255 in the chosen base.

The tool enforces strict validation during decoding:

  • If the input contains characters that are invalid for the selected base, or if any token falls outside the 0–255 range, the tool displays: "Not valid byte codes — each value has to be one byte (0–255) in the chosen base."
  • If the byte values do not form a valid UTF-8 sequence, the tool cannot reconstruct the text and displays: "Those bytes aren’t valid UTF-8, so they can’t be shown as text."

Upon successful decoding, the status displays "Decoded."


Number Base Characteristics

Computers and digital systems utilize different number bases to represent and process data. Understanding how these bases relate to one another is fundamental to working with low-level data.

Base Name Radix (Base) Allowed Characters Common Use Case
Binary 2 0, 1 Low-level machine instructions and hardware states.
Octal 8 0 to 7 Compact representation of binary groups of 3 bits.
Decimal 10 0 to 9 Human-readable numerical representation.
Hexadecimal 16 0 to 9, A to F Compact representation of binary groups of 4 bits (nibbles).

Because hexadecimal aligns perfectly with 8-bit bytes (where one byte is represented by exactly two hex digits), it is widely used by developers to inspect memory, define color codes, and analyze network packets. Octal serves a similar purpose but groups bits by three, which is historically common in certain system architectures and file permission settings.


Local Browser Processing and Privacy

This tool processes all data locally. Every conversion runs in your browser, meaning your numbers and text never leave your device. There is no transmission of your input data to external servers, making it suitable for processing sensitive technical data or configuration values.


Frequently Asked Questions

What can I convert here?

Two things. Number mode links binary, octal, decimal, and hexadecimal — edit any one field and the rest update instantly. Text mode turns any text into its byte values in the base you pick, and reads those bytes back into text.

Does it handle negative and very large numbers?

Yes. Negatives keep a leading minus in every base, and there is no size limit worth worrying about — values convert exactly, with no rounding. There is no fixed-width two’s-complement view, since that only makes sense once you pick a bit width.

Is my input sent anywhere?

No. Everything is computed locally in your browser, so nothing you type is uploaded.

Why do my hexadecimal outputs contain leading zeros?

When converting text to bytes, the tool pads hexadecimal values with leading zeros to 2 bits to maintain a consistent byte-width representation. Binary is padded to 8 bits, and octal is padded to 3 bits for the same reason. Decimal values do not receive padding.