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

Why 255 keeps showing up

The same value in base 2, 8 and 16.

Input
255
Output
binary   11111111
octal    377
hex      ff

255 is eight 1-bits, which is why it is the ceiling of a single byte and the top of each RGB channel. ff is two hex digits precisely because one hex digit covers exactly four bits.

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.

Which numbers are worth memorising?

Boundary values are more useful than random ones. Straight out of this page: 255 is ff in hex and 11111111 in binary — the ceiling of one byte, eight ones. Add one and you cross it: 256 is 100 and 100000000. And 4095 is fff, which shows exactly why one hex digit maps to four bits; 65535 is ffff, the ceiling of two bytes. Learn those four and most hex stops needing a lookup.

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).