Converters

Base Converter

Convert between bases 2–36 including binary, octal, decimal and hex.

Input Number
From
Tips: Supports 0x(hex), 0b(bin), 0o(oct) prefixes. Invalid chars are auto-filtered.
Result
To
Result will be shown here
Quick Convert

What is Number Base Converter?

Number base converter transforms numbers between different numeral systems (binary, octal, decimal, hexadecimal, and more).

Common Bases

  • Binary (2): 0b prefix, e.g., 0b11111111 = 255
  • Octal (8): 0o prefix, e.g., 0o377 = 255
  • Decimal (10): Standard numbers, e.g., 255
  • Hexadecimal (16): 0x prefix, e.g., 0xFF = 255

Use Cases

  • Programming and debugging
  • Color code conversion
  • Network addressing
  • Bitwise operations

Rewrites one integer from any radix between 2 and 36 into another, using the digit set 0-9 plus A-Z. Base 10 255 becomes FF in base 16 or 73 in base 36. Use it for bit masks, color channels, protocol fields, and short case-insensitive base-36 identifiers.

Where the 36 radices come from

The digit set is fixed at 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ, and a digit is just its index in that string, so base 11 stops at A and the largest single digit in base 36 is Z, worth 35. Ten digits plus twenty-six letters give exactly thirty-six symbols, which is also why both selectors end at 36: JavaScript parseInt and Number.prototype.toString accept no radix outside 2-36, and no single character exists to name a digit 37. Lowercase input is tolerated because validation compares the uppercased string, but output is always uppercase. Base 36 is the densest positional notation available here, so 4294967295 spends 7 characters as 1Z141Z3 instead of 8 hex digits, and being case-insensitive it survives URLs and filenames. Unlike Base64 and Base32, which re-chunk a byte stream, nothing in a base conversion is padded or block-aligned.

Every conversion passes through a float64

The pipeline is parseInt(text, from) then toString(to), and both steps hold the value in an IEEE 754 double. Integers are exact only up to 2^53 - 1 = 9007199254740991, whose hex form is 1FFFFFFFFFFFFF. Enter 9007199254740993, one higher, and the hex answer is 20000000000000 — identical to 2^53 — because the double cannot store the odd value and rounds to even. Any 64-bit word therefore breaks: FFFFFFFFFFFFFFFF comes back as 18446744073709552000 instead of 18446744073709551615. Fractions are stopped in validation instead of being truncated silently: . and , are rejected outright, which matters because parseInt("1.5", 10) is 1. For 64-bit values or fractional digits, do the digit loop against BigInt in your own code.

Prefixes, leading zeros, and the minus sign

Radix prefixes are detected and rewrite the source base: 0x selects 16, 0b selects 2, 0o selects 8. Detection runs after a keystroke filter that has already deleted characters illegal in the current base, so pasting 0xFFFFFFFF while base 10 is selected leaves only the two prefix characters and an empty-input error. A bare leading zero is not octal either: 0377 read as base 10 stays 377, and octal must be written 0o377. The result text carries neither padding nor prefix, so 00FF and FF both convert to the integer 255, and the 0x, 0b or 0 printed beside the answer is a display label only. Negatives keep a literal minus sign: -255 in base 10 gives -FF, since no bit width is assumed anywhere.

Worked example

An unsigned 32-bit mask, converted to decimal

Input
FFFFFFFF, from base 16 to base 10
Output
4294967295

Eight hex digits are weighted positionally, giving 2^32 - 1. Two properties of the result follow from the implementation: no 0x prefix and no leading zeros, because toString emits digits only, and a positive value, because the tool never assumes a width. Enter -1 in base 10 instead and base 16 returns -1, not FFFFFFFF.

Limits and pitfalls

  • Values above 9007199254740991 (2^53 - 1) are rounded to the nearest double before conversion, so a full 64-bit word like FFFFFFFFFFFFFFFF becomes 18446744073709552000.
  • Radix is capped at 36 because digits are single characters 0-9 and A-Z; base 58, base 62 and Base64 alphabets used by Bitcoin, Flickr-style ids or MIME cannot be selected.
  • Leading zeros and fixed widths disappear: 00FF, 0x00FF and FF all become the same integer, and the result cannot be pasted back as a padded 16-bit or 8-bit mask.
  • Negative output is sign-magnitude with a leading minus, never two-complement, so an 8-bit FF for -1 or a 32-bit FFFFFFFF has to be computed as 2^n plus the value by hand.
  • A prefix is only honoured when the digits after it are legal in the currently selected input base, so 0xFFFFFFFF pasted while base 10 is active yields an error instead of switching to hex.

Related tools

This page, one shell line, or a different tool: six decisions

What you are holdingBase Converter on this pageWhat to reach for instead
A single value you want to look at onceType it in whichever base it was written — base 36 included, which is the part a shell cannot do — and the digits are uppercased and shown unpadded as you type.printf "%x" 255 is quicker if a terminal is already open, but it only reads decimal, a hex input has to be written as 0x, and there is no 36 in its repertoire.
A 64-bit id: a snowflake, a hash prefix, a UUID pairEvery integer of 17 or more decimal digits is already past 9007199254740991, so it has been rounded to a double before the digits are printed and the low digits of the answer can be wrong.Keep it out of a float: int(s, 36) with format(n, "36") in Python, or BigInt(s) in Node, both hold the full width. Use this page only for values you can read at a glance.
An id that has to travel in a URL or a filenameBase 36 output is 0-9 and A-Z only, no padding, no + or /, and lowercase is accepted back on input — so the answer goes into a query string or a path unchanged.If the payload is bytes rather than a number, the Base32 tool here is the right alphabet: A-Z plus 2-7, but it pads with = in 8-character groups, which a base conversion never does.
Something that is bytes, not a numberValidation admits only characters that exist as digits in the selected base, so UTF-8 text, a binary dump, or anything containing . stops at the error line instead of converting.The Hex tool turns arbitrary bytes into two characters per byte and back; the Base32 tool does the same for transport-safe text. Neither can carry a 64-bit word as a number, which is the only thing this page is for.
A fixed-width mask you will paste into configWidth is never assumed and leading zeros are not kept: 00FF and FF are the same integer, and in base 16 the input -1 answers -1, not FFFFFFFF.printf "%08X" 255 pads to eight hex digits, and (n >>> 0).toString(16).padStart(8, "0") forces the unsigned 32-bit form in JS. Choose them whenever the width itself carries meaning.
A whole column, or the same conversion inside CIOne input, one output: no file picker and no list mode, so a 200-row table is 200 pastes and the typo risk simply moves into the pasting.A four-line script over the source file — int(x, 36) inside a list comprehension — emits the same digits and leaves a diff you can review and rerun.

One character table decides every radix from 2 to 36

RadixCharacters the input acceptsHighest digit, and its valueWhere you meet it
20 and 11 = 1a single flag bit, or a mask written out bit by bit
80 to 77 = 7file modes such as 644 and 755
100 to 99 = 9the source base both selectors open on
110 to 9, plus AA = 10the first radix in which a letter appears at all
160 to 9, plus A to FF = 15colour channels, MAC octets, UUID groups
320 to 9, plus A to VV = 31the alphabet left once W, X, Y and Z are dropped
360 to 9, plus A to ZZ = 35short ids that must stay case-insensitive and URL-safe

Both menus are filled by a loop from 1 to 36, so Base 1 is listed — but the character set for base 1 is an empty string, the keystroke filter drops everything typed into it, and no value can ever be converted from it. Base 37 has no menu entry because the alphabet ends at Z. The 0b, 0 or 0x printed to the left of a result comes from the preset list and is not part of the copied text.

Frequently Asked Questions

Why does 0.1 + 0.2 not equal 0.3 in binary?
Computers store fractions in IEEE 754 binary floating point, and 0.1 is an infinitely repeating fraction in base 2 — stored only approximately. That is the origin of the classic interview question. Integer conversions here are exact; decimals show the true floating-point approximation.
Why is hexadecimal everywhere in programming?
Because 16 is 2 to the 4th: one hex digit maps to exactly 4 bits, two digits to a byte. Memory addresses, color values, and hash digests written in hex are compact yet mentally convertible to binary — the ideal bridge between humans and bytes.
How are negative numbers represented in binary?
Modern machines use two’s complement: the top bit signals the sign, and -1 in 8 bits is 11111111. Understanding two’s complement is essential for bit operations, packet inspection, and register reading — the tool handles signed conversions and shows the complement form.

Content reviewed: