Converters

Convert a number between binary, octal, decimal and hex

Base converter shows a whole number in binary, octal, decimal and hex at once, in your browser. Type 255 and read 11111111, 377, 255 and FF. It is the view you want when a subnet mask, memory address, register value or permission constant is written in one base and your code needs another. Numbers are exact at any size, since the arithmetic uses big integers, and "From" lets you say what base you typed (binary, octal, decimal, hex, base 32 or base 36), or leave it on "Auto" and use a 0b, 0o or 0x prefix.

How to use Base Converter

  1. Open Base Converter in the Toolbox101 app.
  2. Type a whole number into the Number box: 255, 0xFF or 0b11111111.
  3. Leave From on Auto (a 0b, 0o or 0x prefix picks the base, otherwise decimal), or choose the base your number is written in.
  4. Read the Binary, Octal, Decimal and Hex lines in the Output box.
  5. Click Copy to keep the four-line result for your notes or commit message.

Worked example

Base Converter returns the output below for this input.

Input

255

Output

Binary: 11111111
Octal: 377
Decimal: 255
Hex: FF

Check it yourself: open Base Converter and enter the same input.

Frequently asked questions

Does the converter read hexadecimal and binary input?

Yes. With From on Auto, a 0x, 0b or 0o prefix selects hex, binary or octal and anything else is decimal. Or pick the base yourself: with From set to Hexadecimal, FF and 0xFF both read as 255. Underscores and spaces inside the number are ignored, so 1111_0000 works.

Why is the hex output in uppercase?

Uppercase A–F is this converter's display style, matching how CSS color codes and many register dumps write hex. Case carries no information in hex, so 0xFF and 0xff name the same value.

What happens with negative numbers and very large ones?

Negative numbers keep their sign in every base: -5 prints -101, -5, -5 and -5. Size is not a limit, because the conversion uses big integers rather than JavaScript's 53-bit numbers, so 2^80 or a 256-bit hash read as a number convert exactly. Fractions are not supported; a . is reported as an invalid digit.

How is this different from the Binary to Decimal converters?

The single-pair tools, Binary to Decimal, Hex to Decimal and the others, convert one direction between exactly two bases and accept several numbers, one per line. This one takes a single number and shows all four bases at once. Reach for it when you want the full picture.

Use Base Converter now

Runs in your browser. Nothing you type is uploaded.