Skip to content
ConvertersRuns in your browser

Number Base Converter (Binary, Octal, Hex)

This number base converter switches a whole number between binary, octal, decimal and hexadecimal.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the Number Base Converter (Binary, Octal, Hex)

A number base converter for binary, octal, decimal and hexadecimal — type a whole number and see the same value written out in all four bases at once.

This number base converter switches a whole number between binary, octal, decimal and hexadecimal instantly. Number bases are just different ways to write the same quantity. Enter a value, tell the converter which base it is in, and it shows the equivalent in binary, octal, decimal and hexadecimal all at once.

Place value in any base

decimal 255 = 2·100 + 5·10 + 5·1
binary  11111111 = 128+64+32+16+8+4+2+1
hex     FF = 15·16 + 15·1

Every base works the same way — each digit is worth the digit times the base raised to its position.

Why hex and binary pair up

One hexadecimal digit covers exactly four binary bits, so FF is 11111111. That is why hex is the shorthand of choice for colours, memory addresses and byte values.

Worked example

Entering 255 in decimal:

binary  11111111    = 128+64+32+16+8+4+2+1
octal   377         = 3×64 + 7×8 + 7×1 = 192+56+7
hex     FF          = 15×16 + 15×1 = 240+15
bits    8

Every line is the same quantity, which is the whole point of the tool. Run it the other way and 11111111 typed as base 2 returns 255, FF typed as base 16 returns 255, and 377 typed as base 8 returns 255.

A power of two shows the pattern even more clearly. 1024 is 10000000000 in binary — a single 1 followed by ten zeros, needing 11 bits — 2000 in octal and 400 in hexadecimal. Each trailing zero digit is one more factor of the base.

What the input accepts

Every base is validated against its own digit set, so a mistake is caught rather than quietly reinterpreted:

BaseAllowed digits
Binary0 and 1 only — a 2 is rejected
Octal0 to 7 — an 8 or 9 is rejected
Decimal0 to 9
Hexadecimal0 to 9 and A to F, upper or lower case

A leading 0x or 0X is stripped to match how hex is written in code, so 0xFF, FF and ff all give 255. Underscores and spaces inside the value are removed too, which keeps grouped digits readable: 1111_1111 and FF FF both parse.

Only non-negative whole numbers are supported. Negatives are refused, and so are fractions — and that is not an arbitrary restriction. 0.1 has no exact binary representation at all, being the infinitely repeating 0.0001100110011…, which is the same reason decimal money arithmetic goes wrong in floating-point code.

Where bases turn up, and the one real limit

Two hex digits are exactly one byte, so hexadecimal is how colours (#FF8800 is three bytes), memory dumps and raw byte values get written. Octal survives in Unix file permissions, where 755 reads as three groups of three bits — rwxr-xr-x. Binary is the language of flags and bitmasks, where each bit is one independent on/off setting.

The limit is precision, and it is worth knowing before you trust a very large answer. Conversion runs on JavaScript numbers, which are 64-bit doubles, so results are exact only up to 2⁵³ − 1 = 9,007,199,254,740,991 — thirteen hexadecimal digits or 53 binary digits. Past that, integer arithmetic begins losing the low-order digits and the answer becomes approximate; you would need a big-integer library rather than a browser calculator. Within that range every conversion here is exact, with no rounding at any step. Roman Numeral Converter does the same job for a non-positional system.

Private and instant

Conversions run locally in your browser using integer arithmetic — nothing is uploaded and no account is needed.

Step by step

How to use the Number Base Converter (Binary, Octal, Hex)

  1. Type a value and choose the base it is written in.

  2. Read the decimal equivalent as the headline.

  3. See the same number in binary, octal, decimal and hexadecimal in the table.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

All four bases at once

One entry shows the value in binary, octal, decimal and hexadecimal together, so you never convert in steps.

Flexible input

Hex letters can be upper or lower case and a leading 0x is ignored, matching how bases are written in code.

Validated per base

The input is checked against the selected base — a '2' in binary is rejected rather than silently misread.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

What is a number base?

It is how many unique digits a system uses. Decimal (base 10) uses 0–9, binary (base 2) uses 0 and 1, octal (base 8) uses 0–7, and hexadecimal (base 16) uses 0–9 then A–F for 10–15.

Why do computers use binary and hex?

Hardware switches are naturally on/off, which is binary. Hexadecimal is a compact, human-friendly shorthand for binary, since one hex digit maps exactly to four bits.

How do I convert binary to decimal by hand?

Each bit is worth a power of two, doubling from right to left. So 11111111 = 128+64+32+16+8+4+2+1 = 255. The calculator does this instantly for any length.