Skip to main content

Number Base Converter

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

Base conversion (edit any field, the rest sync live)

Text ⇄ Binary / Hex

What is a number base converter?

Computers work in binary, programming leans on hexadecimal (colors, memory addresses, Unicode code points), and people think in decimal. This number base converter converts between binary, octal, decimal and hex live — edit any field and the other three update instantly — and it can also turn text into binary or hex and back. Everything runs locally in your browser.

How to use

  1. In the "base conversion" area, type a number into any field; the other bases sync instantly.
  2. For text, use the "Text ⇄ Binary / Hex" area: paste text to get binary and hex, or paste binary or hex to decode it back to text.
  3. Copy any result in one click.

Common use cases

  • Turn a hex value from a log or memory dump into decimal.
  • Make sense of bit masks, flags and permission values.
  • Convert a string to its byte sequence for debugging. Need Base64? Use the Base64 tool; for color codes, the color converter.

Why does binary-to-text come out as garbage?

There are two separate areas here — don't mix them up. The "base conversion" block above rewrites a single number in different bases (seeing 255 as ff); the "Text ⇄ Binary" block below splits text into bytes via UTF-8. Paste binary that was meant as a number into the text field and you'll usually get garbage — its bits aren't necessarily a valid UTF-8 byte sequence. The rule for decoding text is: the bit count must be a multiple of 8 (one byte per 8 bits) and form valid UTF-8. Also note that a Chinese character is usually 3 bytes (24 bits), not one, and emoji are more — so "text to binary" comes out longer than you might expect.

Frequently Asked Questions

Can it convert very large numbers?

Yes. It uses JavaScript BigInt, so it handles arbitrarily large integers without the precision loss a plain parseInt suffers beyond the safe-integer range.

How does "text to binary" work?

It encodes your text to UTF-8 bytes first, then writes each byte as 8 bits of binary (or two hex digits). Chinese, emoji and other characters convert correctly, and decoding reads the bytes back as UTF-8.

Are 0x and 0b prefixes supported?

Yes. Hex works with or without 0x, and binary with or without 0b — the prefix is ignored. A character that is invalid for that base (like a "g" in hex) is flagged as an error without affecting the other fields.

Are negatives or decimals supported?

This tool is built for non-negative integers — the most common base-conversion case. Two’s-complement for negatives and the bit layout of floating-point numbers are advanced topics outside its scope.

Related reading

Binary, Decimal and Hex Explained: How to Convert Between Number Bases →

Embed this tool

Add this tool to your own website or blog for free — just copy and paste the code below (it includes a link back to this site).