BigInt precisionBit length & widthPer-digit error messages

Number Base Converter

Convert a whole number between binary, octal, decimal, hexadecimal, base 32 and base 36, with bit length, storage width and two’s complement for negatives. All processing happens locally in your browser.

Numeric bases

Convert a whole number between six bases

Values are parsed with BigInt, so integers beyond the 2^53 limit of JavaScript numbers stay exact. This page converts numbers; to turn text into hex bytes use the Hex Converter.

Source baseBase 10
Bit length8 bits
Bytes needed1
Bits set to 18
Input · base 10Decimal value
Output formatting
OutputThe same value in every base
The input value expressed in each supported base
BaseRadixValue
Binary21111 1111
Octal8377
Decimal10255
Hexadecimal16FF
Base 32327V
Base 363673
Storage widthThis value needs 8 bits and fits an unsigned 8-bit integer, or a signed 16-bit integer.
Load sampleLoad a value

What is a number base?

A base — also called a radix — is how many distinct digits a numeral system uses, and therefore how much each position is worth.

In decimal, positions are powers of ten. 253 means:

2 × 10²  +  5 × 10¹  +  3 × 10⁰
  200    +    50     +    3     = 253

Change the base and only the multipliers change. The same number in hexadecimal is FD:

F × 16¹  +  D × 16⁰
15 × 16  + 13 × 1
  240    +   13     = 253

The quantity never moved. Only its written form did. That is the whole idea — a base is notation, not arithmetic.

Scope: this page converts numbers. If you want to turn the text 253 into the bytes 32 35 33, that is a byte-level operation — use the Hex Converter instead. The two questions look similar and give completely different answers.

Valid digits per base

A base with radix n uses exactly n digits, starting at zero. Once the numerals run out, letters continue the sequence.

Base Name Valid digits Prefix in code 255 becomes
2 Binary 0 1 0b 1111 1111
8 Octal 07 0o 377
10 Decimal 09 none 255
16 Hexadecimal 09, AF 0x FF
32 Base 32 09, AV none 7V
36 Base 36 09, AZ none 73

Base 36 is the ceiling for this notation, because it exhausts the ten numerals and all twenty-six Latin letters. Anything beyond it needs a different alphabet — Base64 and Base58 are encodings with their own character sets rather than positional bases in this sense.

Notice the prefixes. 0x, 0o and 0b are not part of the value; they tell a compiler which base to read. This matters in a specific legacy case: in C, Java and older JavaScript, a bare leading zero means octal, so 010 is 8, not 10. That has caused real bugs in code parsing zero-padded input.

How to convert a number

  1. Select the base you are typing in This is the source base. The tool cannot infer it — 101 is a valid number in every base, meaning 5 in binary, 65 in octal, 101 in decimal and 257 in hex.
  2. Enter the value Spaces, underscores, commas and a matching prefix are stripped, so 0xFF, FF and 1111_1111 all work. A leading minus sign is accepted.
  3. Read every base at once All six representations update together. Digit grouping, prefixes and letter case are display options and do not affect the copied value's digits.
  4. Check the width panel Bit length, bytes needed and the smallest fixed-width integer that holds the value are shown, which is usually the actual question when you are debugging a field or a register.

Examples worth recognising

Value Where you meet it Other bases
255 Maximum value of one byte; the 255 in an RGB channel 0xFF, 0b11111111, 0o377
0o755 Unix permissions rwxr-xr-x 493 decimal, 0x1ED
0o644 Unix permissions rw-r--r-- 420 decimal, 0x1A4
65535 Highest TCP/UDP port; unsigned 16-bit maximum 0xFFFF
2147483647 Signed 32-bit maximum, the classic overflow boundary 0x7FFFFFFF
9007199254740991 Number.MAX_SAFE_INTEGER, 2⁵³ − 1 0x1FFFFFFFFFFFFF

Why octal survives for file permissions

Three bits express exactly one octal digit, and Unix permissions come in groups of three bits — read, write, execute. So each octal digit maps to one permission set with nothing left over:

0o755  =  111 101 101
          rwx r-x r-x
          │   │   └── other:  5 = 101 = r-x
          │   └────── group:  5 = 101 = r-x
          └────────── owner:  7 = 111 = rwx

Hexadecimal has the same property for bytes, since one hex digit is exactly four bits and a byte is two digits. Neither base is more "computer-friendly" in the abstract; each aligns cleanly with a particular bit-group size.

Large numbers, and why BigInt matters here

JavaScript numbers are IEEE 754 doubles, exact for integers only up to 2⁵³ − 1. Past that, conversions silently return the wrong answer:

9007199254740993          // typed literally
(9007199254740993).toString(16)
// "20000000000000"        — wrong, the value became ...992

BigInt("9007199254740993").toString(16)
// "20000000000001"        — correct

This page parses with BigInt throughout, so Snowflake IDs, 64-bit hashes, large database keys and Twitter-style identifiers convert exactly. There is no practical upper limit beyond available memory.

Negative numbers and two's complement

A minus sign works, and every base shows a signed result. But hardware and low-level code do not store a sign — they use two's complement at a fixed width, which is why a negative value read from a register looks like a huge positive one.

For -1 at 32 bits:

Signed decimal:   -1
32-bit hex:        0xFFFFFFFF
Read as unsigned:  4294967295

When the input is negative, the tool also shows the 32-bit two's complement form. That is the explanation for the classic bug where a temperature sensor reports 65535 instead of −1: the value was read as unsigned at the wrong width.

Not supported: fractional values. 0.5 in binary is 0.1, and many decimal fractions have no finite binary form — 0.1 repeats forever, which is the root of floating-point rounding surprises. This page converts integers only, deliberately, rather than producing truncated fractions that look exact.

Use cases

  • Reading bit flags. A permissions integer of 22 is 10110 in binary, telling you which flags are set at a glance. The "bits set to 1" count gives the number of active flags.
  • Setting file modes. Convert between the octal chmod argument and the decimal value an API expects.
  • Checking field widths. Before storing a value, confirm whether it fits an unsigned 16-bit or signed 32-bit column.
  • Debugging colour values. A hex colour is three or four byte-sized numbers; converting a channel to decimal connects #FF8000 to rgb(255, 128, 0). The Color Converter does the full conversion.
  • Shortening identifiers. Base 36 gives a compact alphanumeric form of a large integer, useful for URL-safe short IDs.
  • Reading memory addresses. Addresses in crash dumps and disassembly are hexadecimal; converting to decimal makes offsets easier to subtract.

Privacy

Parsing and formatting run in your browser using BigInt. Nothing you type is uploaded, which is worth knowing when the value is an internal identifier or a production key.

Frequently Asked Questions

Why do I have to pick the source base?

Because the same digits are valid in several bases and mean different things. "101" is 5 in binary, 65 in octal, 101 in decimal and 257 in hexadecimal. Guessing would be wrong roughly three times out of four, so the tool asks instead.

Can it handle numbers larger than 2^53?

Yes. Parsing and formatting use BigInt, so 64-bit IDs, large hashes and Snowflake-style identifiers convert exactly. Plain JavaScript number conversion silently loses precision past 9007199254740991, which is the specific failure this avoids.

Why does 010 mean 8 in some languages?

A bare leading zero is the legacy octal prefix in C, Java and pre-ES5 JavaScript. Modern code uses 0o10 explicitly for octal, and JavaScript strict mode rejects the old form. This tool ignores leading zeros entirely and uses the base you selected.

What does "bits set to 1" tell me?

It is the population count, or Hamming weight. For a bit-flag integer it is the number of flags currently enabled, which is a fast way to sanity-check a permissions or feature-toggle value without expanding the whole binary string.

Why can I not convert 3.14?

Fractional base conversion is usually misleading rather than useful. Most decimal fractions have no finite binary representation, so any output would be a rounded approximation presented as if exact. Restricting the tool to integers keeps every answer verifiable.

Is base 36 the same as Base64?

No. Base 36 is positional: each digit position is a power of 36, and the value is a number. Base64 is a binary-to-text encoding that maps groups of bits to characters and represents arbitrary data, not a numeric quantity. Use the Base64 Encoder & Decoder for that.