Number Base Converter (Binary / Octal / Decimal / Hex)
Enter any whole number along with its base and instantly see it in binary, octal, decimal and hexadecimal. The converter accepts the 0x / 0b / 0o prefixes, space- or underscore-separated digits, negative values, and arbitrarily large integers (computed with BigInt).
Please enter digits that are valid in the chosen base (e.g. binary only accepts 0 and 1).
Decimal
—
Hexadecimal 0x
—
Binary 0b
—
Octal 0o
—
Formula
value = Σ digit_i × base^i Reverse: repeatedly divide by the target base; the remainders (least-significant first) spell out the new representation.
- · Hexadecimal output is always uppercase A–F; input may use either case.
- · You may include the 0x (hex), 0b (binary) or 0o (octal) prefix on input — it is stripped automatically.
- · Whitespace, underscores `_` and commas `,` inside the input are ignored, so values like `DEAD_BEEF` or `1,000,000` work as-is.
- · Negatives use a leading `-`. BigInt stores values as sign-magnitude — this is not two’s complement, so it does not produce the `0xFFFF_FFFF` representation of −1 you would see on a 32-bit CPU. Use a dedicated width to model that.
- · “Bits needed” is the minimum number of binary digits required for the absolute value (⌊log₂|x|⌋ + 1, with zero treated as 1 bit).
- · Everything runs in the browser using JavaScript BigInt, so there is no practical limit on integer size.
Frequently asked
Why does −1 show as “−1” here instead of 0xFFFFFFFF?
This tool stores negatives as sign-magnitude with no fixed width — so −1 stays −1. A 32-bit CPU register represents −1 as 0xFFFFFFFF using two’s complement. To get that representation, take the binary of |x|, flip every bit within your chosen width, and add 1 — or just enter 0xFFFFFFFF as a positive value.
How large a number can I enter?
Internally the converter uses JavaScript BigInt, so the limit is practical (browser memory) rather than fixed. Even 2¹²⁸ − 1 (39 decimal digits) returns instantly, and cryptographic sizes like 256- or 512-bit values work as well.
Are the binary and hex outputs grouped for readability?
Yes. Binary is grouped every 4 bits (one nibble, matching one hex digit) and hexadecimal every 4 characters (16 bits / one word). The per-row Copy button puts the raw, unseparated value on your clipboard.
In C-style languages, what do the 0x, 0b and leading-0 prefixes mean?
0x → hexadecimal, 0b → binary (a GNU extension to C99 and standard in C++14), a bare leading 0 → octal (the C/C++/Java default; JavaScript and Python use the explicit 0o prefix). This converter accepts all three explicit forms.
Related tools
Length Unit Converter
Cm, m, km, in, ft, yd, mi — common length units, converted instantly.
Temperature Converter
Convert between Celsius (°C), Fahrenheit (°F) and Kelvin (K) instantly.
Shoe Size Converter (US / UK / EU / CM)
Enter your foot length or a size in any system to see the equivalent US / UK / EU and centimetre sizes.
Paper Size Reference
Pick a paper size (A0–A10, B / C series, Letter, Legal, card sizes) to see its mm / cm / inch / pixel dimensions.
Aspect Ratio & Screen Size Calculator
From an aspect ratio and one side, find the other; or from a diagonal and ratio, get real width and height (4:3, 16:9, 21:9 …).
Data Storage Unit Converter (B/KB/MB/GB/TB)
Convert between bytes, KB, MB, GB, TB and PB — distinguishing decimal (1000-base, drive labels) from binary (1024-base, OS-reported).
RGB ↔ HEX ↔ HSL Color Converter
Convert between HEX (#RRGGBB), RGB(0–255) and HSL(0–360, 0–100, 0–100) instantly — with a live colour preview swatch.
Tire Size Calculator (Spec / Diameter / Speedometer Error)
Convert a P-metric tire spec (e.g. 225/65R17) into sidewall height, overall diameter, circumference and revolutions per km — and compare against a reference size to see speedometer error.
Energy Unit Converter (J / kJ / cal / kcal / kWh / BTU / Wh)
Convert between joules, kilojoules, calories, kilocalories, kilowatt-hours, BTU and watt-hours in a single view — for nutrition labels, electricity bills, heating and fuel comparisons.
Pressure Unit Converter
Convert between Pa, kPa, bar, mbar, atm, psi, mmHg, Torr and inHg in a single view — all the everyday pressure units.
Torque Unit Converter
Convert between N·m, kgf·m, kgf·cm, lbf·ft, lbf·in and ozf·in — all the torque units used on torque wrenches, bicycle bolts and car service specs.
Angle Unit Converter
Convert between degrees, radians, gradians, turns, arcminutes, arcseconds, milliradians and NATO mil — with live sin/cos/tan values for reference.
Fuel Economy Converter (MPG ⇄ L/100km)
Convert between L/100km, km/L, US MPG and UK (imperial) MPG — compare car efficiency figures across regions without arithmetic.
Power Unit Converter
Convert between W, kW, MW, mechanical horsepower (hp), metric horsepower (PS), BTU/hr, ft·lbf/s, cal/s, kcal/h and refrigeration tons in one view.
px ↔ rem ↔ em Converter
Pick a root font-size (defaults to 16 px) and convert any CSS pixel, rem, em, percentage or point value into the others, with a reference table for common sizes.
Alcohol ABV ↔ Proof Converter & Standard Drinks Calculator
Convert alcohol by volume (ABV %) to US proof and UK proof, plus compute grams of pure alcohol and "standard drinks" per pour for US / UK / AU / HK.
Bandwidth & Throughput Converter (Mbps ↔ MB/s)
Convert network bandwidth (kbps, Mbps, Gbps) to file-transfer rate (KB/s, MB/s, MiB/s) and estimate how long a given file size takes.
Weight / Mass Unit Converter
Kilograms, grams, milligrams, pounds, ounces, stones, tonnes, jin and tael — common mass units, converted instantly.
Battery mAh ↔ Wh Converter (Power Bank Airline Rules)
Enter battery capacity (mAh) and voltage (V) to get watt-hours (Wh) instantly — with a live IATA airline check (100 Wh / 160 Wh cut-offs).
International Bra Size Converter
Enter underbust and bust (or pick a local size) to convert bra sizes across US, UK, EU, AU and JP standards.
International Ring Size Converter
Enter inner circumference (mm) or diameter to cross-reference US, UK, EU, JP and HK ring sizes.