Number Base Converter — Binary, Hex, Decimal, Octal and Base 2–36
Convert integers of any size between binary, octal, decimal, hex, base 32, base 36 and any base 2–36, with a two's complement view.
Type in any field. Prefixes 0x, 0b and 0o, a leading minus, and spaces, commas or underscores between digits are accepted.
16 bits · 2 bytes (magnitude) · 5 decimal digits
Two's complement (fixed width)
| Width | Bit pattern | Hex | Signed | Unsigned |
|---|---|---|---|---|
| 8-bit overflow, truncated | 1110 1111 | 0xEF | -17 | 239 |
| 16-bit | 1011 1110 1110 1111 | 0xBEEF | -16657 | 48879 |
| 32-bit | 0000 0000 0000 0000 1011 1110 1110 1111 | 0x0000BEEF | 48879 | 48879 |
| 64-bit | 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1011 1110 1110 1111 | 0x000000000000BEEF | 48879 | 48879 |
Out of range for a width, the pattern is the low bits only, which is what a cast to int8_t/int16_t/int32_t/int64_t does in C, Java or Go.
Runs entirely in your browser. Nothing you enter is sent to us or stored. Browse all free tools.
Found a problem, or something that could be better? We read every message and we fix things quickly.
This number base converter shows an integer in binary, octal, decimal, hexadecimal, base 32 and base 36 at the same time, plus any base from 2 to 36 you choose. Every row is editable: type a hex value into the hex field and the binary, decimal and the rest update. Prefixes like 0x and 0b, a minus sign, and spaces, commas or underscores between digits are all accepted, so you can paste straight from code or a datasheet.
Numbers are handled as arbitrary-precision integers, so a 64-bit ID, a 256-bit hash value or a 300-digit decimal converts exactly, where tools built on ordinary JavaScript numbers quietly round anything above 9,007,199,254,740,991. The two's complement table shows how the value is stored in 8, 16, 32 and 64-bit signed and unsigned integers, and flags overflow. Fractions are rejected with an explanation rather than converted approximately: many decimal fractions have no exact binary form.
How to use
- Type a number into the field for the base it is written in, for example 0xBEEF in Hexadecimal or 1011 in Binary.
- Read the other bases from the other fields; copy any of them with its button.
- For an unusual base, choose it in the Any base menu and type into that field.
- Check the two's complement table to see the bit pattern at a fixed width, or what a negative number looks like in hex.
- Turn off digit grouping if you need the plain string for code.
Frequently asked questions
How do I convert binary to decimal?
Multiply each binary digit by 2 raised to its position, counting from 0 on the right, and add the results. For 1011: 1×8 + 0×4 + 1×2 + 1×1 = 11. Or type it into the Binary field above and read the Decimal field.
How do I convert hex to decimal?
Each hex digit is worth 16 times the digit to its right, and A–F stand for 10–15. For 0x2F: 2×16 + 15 = 47. Each hex digit also maps to exactly four binary digits (F = 1111), which is why hex is used as a compact way to write binary.
What is two's complement?
It is how computers store negative integers. In an n-bit integer, a negative number −x is stored as 2^n − x. So −1 in 8 bits is 11111111 (0xFF), and −128 is 10000000. The same bit pattern reads as 255 unsigned or −1 signed; the table shows both. The advantage is that addition and subtraction work the same way for signed and unsigned values.
Why does my converter give wrong results for large numbers?
Most converters use JavaScript numbers, which are 64-bit floating point and represent integers exactly only up to 2^53 − 1 (9,007,199,254,740,991). Above that, digits are silently rounded, so a 64-bit database ID or a Twitter/X snowflake ID converts wrongly. This converter uses BigInt, which has no size limit.
Can I convert fractions like 0.1 to binary?
Not here, deliberately. 0.1 in decimal is a repeating fraction in binary (0.000110011…), so any finite answer is an approximation, and that rounding is exactly why 0.1 + 0.2 is not 0.3 in most programming languages. This tool converts integers exactly; to work with fractions, scale them to integers first (for example, store cents instead of dollars).
Where each base shows up
• Binary (base 2): bit flags, network masks, hardware registers, permissions bitfields.
• Octal (base 8): Unix file permissions, where 755 means rwxr-xr-x because each octal digit is exactly three bits (owner, group, others).
• Hexadecimal (base 16): memory addresses, colour codes (#244B3F), byte dumps, hashes, MAC addresses and Unicode code points (U+1F332).
• Base 32 (0–9, A–V): compact identifiers. Note that the RFC 4648 Base32 used by TOTP secrets is a byte encoding with the alphabet A–Z, 2–7, not this number base.
• Base 36 (0–9, A–Z): the most compact case-insensitive alphanumeric representation, used for short IDs and URL shorteners; JavaScript's Number.prototype.toString(36) produces it.
Fixed-width integers and overflow
Programming languages store integers in fixed widths: int8/uint8 (one byte), int16, int32 and int64. A signed n-bit integer covers −2^(n−1) to 2^(n−1) − 1, so an int8 is −128 to 127 and an int32 is −2,147,483,648 to 2,147,483,647. The unsigned version covers 0 to 2^n − 1.
When a value does not fit, most languages keep only the low n bits. That is why 200 stored in an int8 reads back as −56, and why 2,147,483,647 + 1 in a 32-bit int becomes −2,147,483,648. The two's complement table here shows that truncated pattern and marks the row as overflowed, which makes it easy to predict what a cast in C, Java, Go or Rust will produce.
Related free tools
- Color Picker & Converter — Pick any color from anywhere on your screen, or convert instantly between HEX, RGB, and HSL.
- Hash Generator — Hash text or files with MD5, SHA-1, SHA-256, SHA-384, SHA-512 and CRC32, verify a checksum, or compute an HMAC. Files never leave your device.
- Unix Timestamp Converter — Convert epoch seconds, milliseconds, microseconds or nanoseconds to dates in any time zone, and back. Live clock, batch mode, code snippets.
- Online Calculator — A clean, iPhone-style calculator that works with your keyboard and numpad. Percent, sign, history, copy — no ads, nothing installed.