We use cookies

We use cookies and similar technologies to enhance your browsing experience, analyze site traffic, and personalize content and ads. By clicking "Accept", you consent to our use of cookies. Learn more in our Privacy Policy.

Free · in your browser · no signup

Number Base Converter

Convert numbers between binary, octal, decimal and hexadecimal — enter a value in any base and see all the others instantly.

Value
Binary (base 2)
11111111
Octal (base 8)
377
Decimal (base 10)
255
Hexadecimal (base 16)
FF

The Number Base Converter turns a value written in one base into its equivalent in another. It handles the four bases you reach for most often as a developer: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Type a number in any one of them and the others update at the same time, so you can read the same value across every representation without doing the arithmetic by hand.

It runs entirely in your browser. Nothing you type is sent to a server, logged, or stored, which means you can paste an internal ID, a register value, or a permission bitmask without it leaving your machine. There is no sign-up and no install. It is built for the everyday moments where you have a hex color, a file permission, or a bit flag in front of you and need the same number in a base you can actually reason about.

How it works

Enter a value in the field for the base you have, and every other field recalculates instantly. The tool parses your input against the rules of its base, converts it to an internal integer, then re-encodes that integer into each target base.

Key behavior to know:

  • Live, multi-directional conversion — there is no "from" and "to" dropdown to fiddle with. Decimal, binary, octal, and hex are all editable, and editing any one updates the rest.
  • Input is validated per base. A 2 is rejected in the binary field, and a g is rejected in the hex field, so you find out immediately rather than getting a wrong answer.
  • Hex is case-insensitive. FF, ff, and Ff all parse to the same value.
  • Prefixes are tolerated. Common notations like 0x for hex and 0b for binary are accepted, so you can paste straight from code.

Because everything happens locally, conversions are immediate and work offline once the page has loaded.

A worked example

Say you have the hex color component 2A and want to understand it in other bases.

Type 2A into the hexadecimal field. The other fields fill in:

Hex:     2A
Decimal: 42
Octal:   52
Binary:  101010

The math behind the decimal result: hex digit 2 is in the sixteens place and A (which is 10) is in the ones place, so 2 × 16 + 10 × 1 = 42.

For the binary, 42 breaks down into powers of two: 32 + 8 + 2 = 42, which is 101010. You can verify it digit by digit from the right: positions for 2, 8, and 32 are set.

Now edit the binary field to 101011 and watch every field jump to 43 / 2B / 53. That round-trip is the quickest way to sanity-check that a bit you flipped landed where you expected.

Common use cases

A few situations where converting between bases is part of the job:

  • Colors. CSS and design tools use hex (#1E90FF), but you may need the decimal rgb() components, or want to inspect the individual byte values.
  • Bitmasks and flags. Permission and feature flags are often stored as a single integer. Converting to binary shows you exactly which bits are set.
  • Unix file permissions. chmod modes like 755 are octal; seeing the binary (111 101 101) makes the read/write/execute groups obvious.
  • Low-level and embedded work. Register values, memory addresses, and opcodes are usually written in hex but reasoned about in binary.
  • Debugging and logs. When one system logs an ID in decimal and another in hex, a quick conversion confirms you are looking at the same value.
  • Learning. Working through conversions by hand and checking them here is a fast way to build intuition for positional notation.

Tips and gotchas

A few things that trip people up:

  • Leading zeros carry no value but can signal intent. 00FF and FF are the same number. The tool reads them identically; it does not preserve a fixed width for you.
  • This converter is for whole numbers. Fractions like 0.5 or 3.14 are not the same problem as integer base conversion and are out of scope.
  • Mind which field you are in. 10 means ten in decimal, two in binary, eight in octal, and sixteen in hex. The same characters are four different values depending on the base.
  • Hex uses A through F for 10 through 15. A letter beyond F is not a valid hex digit.
  • Watch for prefix confusion. 0x10 is sixteen, not ten. If a number looks an order of magnitude off, check whether a prefix was implied.
  • Octal sneaks into source code. A leading zero in some languages means octal, so 010 can be eight rather than ten. Converting it here removes the ambiguity.

Why these four bases

Positional notation works in any base: a number's value is the sum of each digit multiplied by the base raised to its position. Base 2, 8, 10, and 16 are the ones that matter in practice for a specific reason.

Computers store everything in binary because hardware has two states. Binary is correct but unreadable past a few digits, so we group bits. Here is the elegant part: 8 = 2^3 and 16 = 2^4, so each octal digit maps to exactly three bits and each hex digit to exactly four, with no overlap or remainder.

That clean mapping is why hex is the standard shorthand for raw bytes: one byte is eight bits, which is exactly two hex digits (00 to FF). Octal does the same job for three-bit groups, which is why it fits Unix permissions so naturally. Decimal is the base humans count in, so it is the bridge for anything a person needs to read as a plain quantity. Converting between them is just regrouping the same underlying value.

Tips

  • Paste hex straight from code with the 0x prefix; it is stripped automatically.
  • To inspect a bitmask, read the binary output right to left — position 0 is the lowest bit.
  • One byte is always two hex digits (00 to FF); if you see more or fewer, recount.
  • For chmod modes, convert the octal to binary and read it in groups of three for owner, group, and other.
  • Use the round-trip trick: flip a bit in the binary field and confirm the hex changed the way you expected.
  • Remember 10 is a different number in every base, so double-check which field your cursor is in.

How to use Number Base Converter

  1. 1Enter your number.
  2. 2Pick the base it's currently in.
  3. 3See it converted to binary, octal, decimal and hex.
  4. 4Copy any result — converted locally.

Frequently asked questions

How do I convert hex to decimal?

Type or paste the hex value into the hexadecimal field and read the decimal field, which updates instantly. For example, hex 2A becomes decimal 42.

Does it accept the 0x and 0b prefixes?

Yes. A 0x prefix on hex and a 0b prefix on binary are recognized and stripped, so you can paste values directly from source code.

Is hexadecimal input case-sensitive?

No. FF, ff, and Ff all parse to the same value, so you do not have to normalize the case before entering it.

Can it convert decimal fractions or floating-point numbers?

No. This tool converts whole numbers between bases. Decimal fractions follow different rules and are not supported.

Why does 10 give a different answer in each field?

The digits 10 mean different quantities per base: ten in decimal, two in binary, eight in octal, and sixteen in hex. Always check which base field you are typing into.

Is my data sent anywhere?

No. All conversion happens in your browser. Nothing you enter is uploaded, logged, or stored, so it is safe for internal IDs or sensitive values.

How do I read a Unix permission like 755 in binary?

Enter 755 in the octal field. The binary output is 111101101, which reads as three groups: 111 (owner rwx), 101 (group r-x), 101 (other r-x).

Does it work offline?

Yes. Once the page has loaded, conversions run locally with no network connection required.

← All toolsRead our guides →