BrowserTools
Advertisement
Home / Converters / Number Base Converter (Binary, Octal, Decimal, Hex)

Number Base Converter (Binary, Octal, Decimal, Hex)

Convert numbers between binary, octal, decimal, hexadecimal and any custom base from 2 to 36.

Loading Number Base Converter (Binary, Octal, Decimal, Hex)… If nothing happens, please enable JavaScript.

Frequently asked questions

Is any data sent to a server when I use this tool?
No. All base conversions run entirely within your browser using JavaScript BigInt arithmetic. No numbers or values you enter are ever transmitted to any server, making it safe to use with addresses, tokens, or any sensitive numeric data.
Why do computers use binary instead of decimal?
Digital computers are built from transistors, which are electronic switches that are either on (representing 1) or off (representing 0). Using only two states makes the hardware extremely reliable and resistant to noise — it is much easier to distinguish between a high voltage and a low voltage than between ten different voltage levels. Binary is the simplest positional number system possible, and it maps perfectly to the physical reality of how digital circuits work.
Why is hexadecimal used for color codes and memory addresses?
Each byte of data contains 8 bits and can represent 256 values (0–255). Two hexadecimal digits can represent exactly those same 256 values (00–FF), making hex a compact and lossless way to express bytes. A 24-bit RGB color is three bytes, so it fits neatly into six hex digits. A 64-bit memory address is eight bytes, or sixteen hex digits. Binary representations of the same values would be four times longer and far harder for humans to read.
What do octal numbers have to do with Unix file permissions?
Unix file permissions consist of three groups of three bits each — owner, group, and other — with each bit controlling read, write, or execute access. Three bits can represent values from 0 to 7, which maps perfectly to a single octal digit. So chmod 755 means owner has 7 (rwx = 111 in binary), group has 5 (r-x = 101), and others have 5. Octal was chosen because it was a natural fit for the 3-bit groupings of Unix permissions.
Can I convert very large numbers without precision loss?
Yes. This tool uses JavaScript BigInt, which handles integers of arbitrary size with exact precision. Standard JavaScript numbers (IEEE-754 doubles) can only exactly represent integers up to 2^53 - 1 (9,007,199,254,740,991). BigInt has no such limit, so you can safely convert 256-bit cryptographic keys, large hash values, or any other large integer without any rounding.
What is the history of hexadecimal notation in computing?
Hexadecimal notation in computing was popularized by IBM in the 1960s with the introduction of the IBM System/360 architecture, which used 8-bit bytes. Before the System/360, some machines used 6-bit characters and octal was actually more common. Once 8-bit bytes became the universal standard — perfectly divisible into two 4-bit nybbles — hexadecimal became the natural shorthand. The 0x prefix for hex literals was introduced by the C programming language in the early 1970s and has been adopted by nearly every language since.
Are there edge cases with leading zeros or very small numbers?
In positional number systems, leading zeros do not change the value of a number — 007 in decimal is still 7. However, in some programming contexts, a leading zero has a specific meaning: in C, Python 2, and JavaScript, a numeric literal starting with 0 followed by digits 0–7 is interpreted as an octal number, not decimal. For example, 010 in C means 8, not 10. This is a common source of bugs and is why modern Python requires the explicit 0o prefix for octal literals.
Does this tool support two's complement for negative numbers?
The tool displays negative numbers with a minus sign prefix, but does not compute two's complement representations. Two's complement depends on the word size — the same value -1 is represented as 0xFF in 8 bits, 0xFFFF in 16 bits, and 0xFFFFFFFF in 32 bits. Since the intended word size is context-dependent, you would need to apply the appropriate bit mask yourself after obtaining the positive representation from this tool.
Which base conversions are worth knowing by heart?
A handful are invaluable: 0xFF = 255 (maximum single byte value), 0x80 = 128 (midpoint of a byte), 0x10 = 16 decimal, 0x100 = 256. In binary, 1111 = 15 = 0xF, and knowing that each hex digit equals exactly four binary digits (nybble) is the single most useful shortcut for reading hex dumps and memory addresses.
What is a common beginner misunderstanding about binary numbers?
A very common misconception is that binary numbers are somehow 'less precise' or 'approximate' versions of decimal numbers. In fact, for integers, conversion between bases is always exact — 10 in decimal is always exactly 1010 in binary, with no rounding whatsoever. The precision issue only arises with fractional numbers (0.1 in decimal cannot be represented exactly in binary), which is the source of the famous floating-point rounding errors in JavaScript like 0.1 + 0.2 === 0.30000000000000004.

About Number Base Converter (Binary, Octal, Decimal, Hex)

Positional numeral systems represent numbers using a fixed set of digit symbols, where the value of each digit depends on its position. Humans naturally evolved base-10 (decimal) arithmetic, almost certainly because we have ten fingers. But digital computers are built from transistors that can only exist in two states — on or off — making base-2 (binary) the natural language of computing hardware. Every number, instruction, and piece of text stored on any computer anywhere is ultimately encoded as a sequence of ones and zeros. The other bases — octal (base-8) and hexadecimal (base-16) — emerged as convenient shorthand for binary: one octal digit represents exactly three binary digits, and one hex digit represents exactly four, making them far more compact for human reading of binary data.

Developers encounter multiple bases constantly. Hexadecimal is ubiquitous: CSS colors (#ff6600), memory addresses in debuggers (0x7ffee4b3c8d0), file format magic numbers (0xFF 0xD8 for JPEG), Unix file permissions in numeric form (0755), and network MAC addresses all use hex notation. Binary is essential for understanding bitwise operations, flag fields, network subnet masks, and data encoding. Octal appears in Unix file permission mode strings — the familiar chmod 755 or chmod 644 — and in some legacy communication protocols. Base-36 (using digits 0–9 and letters A–Z) is used in URL shorteners and unique identifier schemes that need compact case-insensitive strings.

This converter accepts a value in any base from 2 to 36 and simultaneously displays it in binary, octal, decimal, hexadecimal, and any custom base you specify. The computation uses JavaScript's BigInt type, which supports arbitrary-precision integers — there is no upper limit on the size of the number you can convert, unlike standard Number which loses precision beyond 2^53. All processing runs in your browser with no server communication.

A few nuances to keep in mind: hexadecimal digits use letters A–F (or a–f) for values 10–15, and the case is not semantically meaningful but conventions differ — CPU registers are traditionally shown in uppercase, while CSS colors are commonly lowercase. When entering binary values, be careful with leading zeros — they are valid and preserved in display but do not affect the numeric value. Two's complement notation, used to represent negative integers in hardware, is not produced by this tool because its output depends on the word size (8-bit, 16-bit, 32-bit, 64-bit) of the target system.

From Fingers to Transistors: Why the World Counts in Base 16

Humans have almost certainly used base-10 for thousands of years simply because we were born with ten fingers. Archaeological evidence suggests tally systems going back at least 40,000 years, and the Babylonians developed a sophisticated base-60 (sexagesimal) system around 2000 BCE — a choice that still echoes in our 60-second minutes and 360-degree circles. The decimal system we use today was formalized in India around the 5th–6th century CE with the invention of positional notation and the concept of zero, then transmitted to Europe through Arab mathematicians, giving us the Hindu-Arabic numerals we use today.

The adoption of binary in computing was not inevitable. Charles Babbage's 19th-century mechanical Analytical Engine used decimal. Early 20th-century computing proposals explored base-3 (ternary) and even base-10 electronic systems. Soviet engineers at the Moscow State University actually built a working ternary computer, the Setun, in 1958, arguing it was more efficient than binary. But binary ultimately won because it required the least engineering complexity — a transistor is either on or off, full stop. Any more states means more careful voltage calibration, more heat, and more error.

Hexadecimal became the dominant human-readable representation of binary data thanks to IBM's System/360 in 1964, which standardized the 8-bit byte as the fundamental unit of information. Once bytes were universal, two hex digits mapping to exactly one byte was irresistible for engineers reading memory dumps and register values. The 0x prefix to mark hex literals was introduced by the C language around 1972 and spread to essentially every mainstream language that followed: C++, Java, Python, JavaScript, Go, Rust, Swift, and more. Today, hex is so entrenched in computing culture that color designers, network engineers, and security researchers all think and communicate in base-16 as a second nature.

Advertisement