A number system converter translates a value between bases — binary (2), octal (8), decimal (10) and hexadecimal (16), plus Base32/36/64. To convert binary to decimal, multiply each bit by its power of two and add: 1011 = 8 + 2 + 1 = 11. To convert decimal to binary, divide by 2 repeatedly and read the remainders bottom-up. This toolkit also runs a binary calculator, bitwise & programmer operations, an IEEE 754 explorer, text/encoding conversion, a subnet calculator and a truth-table generator — all in your browser.
Binary · Decimal · Hex · Octal Reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
Key Takeaways
- A number system (or base) defines how many unique digits are used to represent values: binary uses 2, octal 8, decimal 10 and hexadecimal 16.
- Computers use binary because transistors have two stable states — on (1) and off (0) — making base-2 the natural language of digital electronics.
- To convert binary to decimal, multiply each bit by its power of two and add the results; to convert decimal to binary, divide repeatedly by 2 and read the remainders bottom-up.
- Hexadecimal is a compact shorthand for binary: each hex digit maps to exactly 4 bits (a nibble), so one byte is always two hex digits.
- Two’s complement is the standard way to store signed integers; the most significant bit indicates the sign and negatives are formed by inverting the bits and adding one.
- IEEE 754 represents real numbers with a sign bit, a biased exponent and a mantissa — explaining why 0.1 + 0.2 is not exactly 0.3 in most languages.
- Bitwise operations (AND, OR, XOR, NOT, shifts and rotates) manipulate individual bits and underpin flags, masks, permissions, graphics and cryptography.
- An IPv4 address is just a 32-bit number written as four 8-bit octets; subnetting splits that space using a prefix length (CIDR).
- This toolkit converts between every base, calculates in binary, inspects bits, decodes IEEE 754, builds truth tables, computes subnets and analyses files — entirely in your browser.
People Also Ask
How do I convert binary to decimal?
Multiply each bit by 2 raised to its position (counting from 0 on the right) and add them up. For 1011: 1×8 + 0×4 + 1×2 + 1×1 = 11.
How do I convert decimal to binary?
Divide the number by 2 repeatedly, writing down each remainder, then read the remainders from bottom to top. 11 → 1011.
What is 255 in binary and hex?
255 is 11111111 in binary (eight 1s) and FF in hexadecimal — the largest value that fits in a single byte.
Why do computers use binary?
Digital circuits are built from switches that are either on or off. Two states map cleanly to the digits 1 and 0, making binary reliable and simple to implement in hardware.
What is hexadecimal used for?
Hex is a human-friendly shorthand for binary used in memory addresses, colour codes (#FF8800), MAC addresses, machine code and debugging, because one hex digit equals four bits.
What is two’s complement?
Two’s complement is how computers store negative integers: invert all the bits of the positive value and add one. It lets the same circuitry add signed and unsigned numbers.
What is a bit and a byte?
A bit is a single binary digit (0 or 1). A byte is 8 bits and can represent 256 different values (0–255), enough for one ASCII character.
How many hosts are in a /24 subnet?
A /24 subnet has 256 total addresses and 254 usable host addresses, because the network and broadcast addresses are reserved.
What Is Binary?
Binary is the base-2 number system — the most fundamental language of computing. Where the decimal system we use every day relies on ten digits (0 through 9), binary uses just two: 0 and 1. Each binary digit is called a bit, short for “binary digit”, and a group of eight bits forms a byte. Despite using only two symbols, binary can represent any number, any character and any piece of data that a computer stores or processes, simply by stringing bits together in the right pattern.
The power of binary lies in place value, exactly like decimal. In decimal, the number 235 means 2×100 + 3×10 + 5×1, where each position is a power of ten. In binary, each position is a power of two instead: the binary number 1011 means 1×8 + 0×4 + 1×2 + 1×1, which equals 11 in decimal. This positional structure is what lets a handful of 0s and 1s encode everything from a single letter to a high-resolution photograph, an entire operating system, or the page you are reading right now.
Number Systems Explained
A number system, also called a numeral system or a base (radix), is a consistent way of representing numbers using a fixed set of digits. The base tells you how many unique digits are available and what each position is worth. The four bases that dominate computing are binary (base 2, digits 0–1), octal (base 8, digits 0–7), decimal (base 10, digits 0–9) and hexadecimal (base 16, digits 0–9 then A–F). Beyond these, Base32, Base36, Base58 and Base64 are widely used for encoding identifiers, URLs and binary data as text.
Every base works on the same principle: the rightmost digit represents base⁰ (always 1), the next represents base¹, then base², and so on. Converting between bases is therefore just a matter of re-expressing the same underlying quantity using different place values. The decimal value 42 is 101010 in binary, 52 in octal and 2A in hexadecimal — four different representations of one identical number. Understanding that bases are merely different costumes for the same value is the key insight that makes all conversions intuitive.
Binary vs Decimal
Decimal is base 10 because humans have ten fingers, and it has been the default counting system across most of history. Binary is base 2 because digital hardware is built from components with two stable states. The two systems describe the same numbers but in radically different lengths: large values that are short in decimal become long strings of bits in binary. The decimal number 1,000,000, for example, is the 20-bit binary number 11110100001001000000.
The trade-off is clarity versus hardware-friendliness. Decimal is compact and familiar to people, but awkward for electronics. Binary is verbose for humans but trivially easy for circuits, which only need to distinguish “high voltage” from “low voltage”. This is why programmers constantly translate between the two — and why intermediate bases like hexadecimal exist, giving a compact written form that still maps cleanly onto the underlying bits.
Binary vs Hexadecimal
Hexadecimal is base 16, using the digits 0–9 followed by A, B, C, D, E and F to represent the values ten through fifteen. Its enormous practical value comes from a neat mathematical coincidence: 16 is 2⁴, so every single hexadecimal digit corresponds to exactly four binary digits (a nibble). The byte 11010110, for instance, splits into 1101 and 0110, which are D and 6 — so the whole byte is simply D6 in hex.
This 4-to-1 mapping makes hexadecimal the preferred way to write binary data for humans. A 32-bit value that would be an error-prone 32-character binary string becomes a tidy 8-character hex string. That is why memory addresses, colour codes, hash digests, machine code and network identifiers are almost always shown in hex. When you read 0xFF, you can instantly know it is 11111111 in binary and 255 in decimal without doing any heavy arithmetic.
Binary Arithmetic
Arithmetic in binary follows the same rules as decimal, just with a carry happening at 2 instead of at 10. Binary addition has only four basic facts: 0+0=0, 0+1=1, 1+0=1 and 1+1=10 (zero, carry one). Subtraction, multiplication and division work analogously. Because the rules are so simple, they can be implemented directly in hardware using logic gates — an adder circuit is one of the first things every computer engineering student builds.
Multiplication in binary is especially elegant: multiplying by two is just a left shift (appending a zero), and dividing by two is a right shift. This is why bit shifting is such a fast, common optimisation. The binary calculator in this toolkit performs addition, subtraction, multiplication, division, modulo, exponentiation and integer square roots with arbitrary precision, showing each result simultaneously in binary, octal, decimal and hexadecimal so you can follow the maths across every base.
Bitwise Operations
Bitwise operations act on the individual bits of a value rather than its numeric magnitude. The core operations are AND (1 only where both bits are 1), OR (1 where either bit is 1), XOR (1 where the bits differ), and NOT (which flips every bit). Compound gates — NAND, NOR and XNOR — are the inverses of AND, OR and XOR, and NAND and NOR are “universal” because any logic circuit can be built from them alone.
Shifts and rotates round out the toolkit. A left shift moves bits toward the most significant end (multiplying by powers of two), a logical right shift fills with zeros, an arithmetic right shift preserves the sign bit, and rotations wrap bits around the ends. These operations power flags and permission bits, bitmasks, hashing, compression, graphics blending, cryptographic primitives and countless low-level optimisations. The Programmer mode here lets you apply every one of them at 8, 16, 32 or 64-bit width and watch the bits change live.
Computer Memory and Binary
Computer memory is, at the lowest level, an enormous array of cells each holding a single bit. Those bits are grouped into bytes, and bytes into words (typically 4 or 8 bytes on modern machines). Every address in memory is itself a binary number, which is why addresses are conventionally written in hexadecimal — a 64-bit pointer like 0x7FFE3C00 is far easier to read and reason about than its 64-character binary equivalent.
Data types are simply agreements about how to interpret groups of bits. The same 32 bits might be read as an unsigned integer, a signed two’s-complement integer, an IEEE 754 floating-point number, four ASCII characters or an RGBA colour, depending entirely on context. Understanding this is fundamental to debugging, reverse engineering, serialization and performance work — and the universal converter and bit inspector in this tool are designed to show you all of those interpretations at once.
ASCII Encoding
ASCII (American Standard Code for Information Interchange) is the foundational scheme for representing text as numbers. It assigns a 7-bit code (0–127) to each English letter, digit, punctuation mark and control character. The capital letter “A” is 65 (binary 1000001), lowercase “a” is 97, the digit “0” is 48, and a space is 32. Because each code fits in a single byte, ASCII text is trivially stored and transmitted as a sequence of bytes.
ASCII’s elegance is in its ordering: letters are contiguous, so converting case is a single bit flip, and digits are arranged so their numeric value is easy to extract. Extended ASCII uses the eighth bit to add another 128 characters, but ASCII’s 128-character core remains the universal baseline that virtually every modern encoding, including Unicode and UTF-8, is built to stay compatible with. This converter shows the ASCII, decimal, hex and binary code of every character you enter.
Unicode and UTF Encoding
ASCII can only represent 128 characters, which is nowhere near enough for the world’s writing systems, symbols and emoji. Unicode solves this by assigning a unique code point — written as U+ followed by a hexadecimal number — to over a million characters, from U+0041 (“A”) to U+1F600 (😀). Unicode is a mapping of characters to numbers; it does not by itself say how those numbers are stored as bytes.
That job falls to encodings, chiefly UTF-8, UTF-16 and UTF-32. UTF-8 is the dominant choice on the web: it is variable-length, using one byte for ASCII characters and up to four bytes for others, which keeps English text compact while supporting every character. UTF-16 uses two or four bytes, and UTF-32 uses a fixed four bytes per character. The encoding tools here convert text to and from UTF-8, UTF-16, UTF-32, hexadecimal and Base64 so you can see exactly how characters become bytes.
Floating Point Numbers
Integers are straightforward in binary, but representing fractional and very large or very small numbers requires floating-point representation. Rather than a fixed number of decimal places, floating point stores a number in a form similar to scientific notation: a sign, a significand (mantissa) and an exponent. This lets a fixed number of bits express an extraordinary range of magnitudes, from subatomic to astronomical, at the cost of limited precision.
The crucial consequence is that most decimal fractions cannot be stored exactly in binary floating point, just as one-third cannot be written exactly in decimal. This is why 0.1 + 0.2 famously evaluates to 0.30000000000000004 in many languages. Understanding floating-point representation is essential for financial software, scientific computing and graphics, where rounding behaviour matters. The IEEE 754 explorer in this toolkit decodes any number into its exact binary layout so you can see precisely where that imprecision comes from.
IEEE 754 Explained
IEEE 754 is the international standard that defines how virtually all hardware represents floating-point numbers. A 32-bit single-precision float is split into three fields: 1 sign bit, 8 exponent bits and 23 mantissa (fraction) bits. A 64-bit double-precision number uses 1 sign bit, 11 exponent bits and 52 mantissa bits, giving far more precision and range. The exponent is stored with a bias (127 for floats, 1023 for doubles) so it can represent both positive and negative powers without a separate sign.
The value is reconstructed as (−1)^sign × 1.mantissa × 2^(exponent − bias) for normal numbers, with special bit patterns reserved for zero, infinity, subnormal numbers and NaN (Not a Number). Decoding these fields explains the quirks of floating-point maths: why some numbers round, why there is both a +0 and a −0, and how the largest and smallest representable values arise. This tool breaks any decimal you enter into its sign, exponent and mantissa bits, and reconstructs the exact stored value.
Computer Architecture and Number Systems
At the heart of every processor is the arithmetic logic unit (ALU), a circuit that performs binary arithmetic and bitwise operations on fixed-width registers. Word size — 8, 16, 32 or 64 bits — determines the largest integer the machine can handle natively and how memory is addressed. The choice of two’s complement for signed integers is an architectural decision that lets one adder handle both signed and unsigned addition, simplifying the silicon enormously.
Endianness is another architectural detail rooted in bytes: big-endian machines store the most significant byte first, while little-endian machines (like x86) store the least significant byte first. This affects how multi-byte values appear in memory dumps and on the network. Concepts like alignment, padding, registers and flags all live at the binary level, which is why fluency in number systems is indispensable for systems programming, embedded development and performance engineering.
Networking and Binary
IP addressing is one of the most visible real-world uses of binary. An IPv4 address such as 192.168.1.1 is really a single 32-bit number, written as four 8-bit octets separated by dots for readability. Converting an address to binary (11000000.10101000.00000001.00000001) reveals the structure that routers actually work with, and is essential for understanding subnet masks, network boundaries and address ranges.
A subnet mask, also expressed in CIDR notation like /24, marks where the network portion of an address ends and the host portion begins by setting the leading bits to 1. Performing a bitwise AND of an address with its mask yields the network address; combining it with the inverted mask gives the broadcast address. MAC addresses, port numbers and packet headers are equally binary at heart. The networking toolkit here converts IPs and MACs to binary and computes full subnet details including usable host counts.
Subnetting
Subnetting is the practice of dividing a large IP network into smaller, more manageable sub-networks. It improves performance by limiting broadcast domains, strengthens security by isolating segments, and conserves the limited IPv4 address space. The prefix length (the number after the slash in CIDR notation) specifies how many of the 32 bits identify the network; the remaining bits identify hosts within it.
The arithmetic is pure binary. A /24 network reserves 24 bits for the network and 8 for hosts, giving 2⁸ = 256 total addresses and 254 usable ones (the first is the network address and the last is the broadcast address). A /30, common for point-to-point links, leaves just 2 usable hosts. The subnet calculator in this toolkit takes any address and prefix and instantly returns the network address, broadcast address, usable host range, total and usable host counts, wildcard mask and address class.
Digital Logic
Digital logic is the discipline of designing circuits that process binary signals. The building blocks are logic gates — AND, OR, NOT, NAND, NOR, XOR and XNOR — each implementing a simple Boolean function of its inputs. Combining gates produces every component in a computer, from adders and multiplexers to memory cells and entire processors. A truth table, which lists the output for every possible combination of inputs, is the canonical way to specify and verify a logic function.
Boolean algebra provides the mathematical rules for simplifying these expressions, reducing the number of gates needed and therefore the cost, power and latency of a circuit. Techniques such as Karnaugh maps and the sum-of-products form help engineers minimise logic. The digital logic toolkit here parses any Boolean expression you type — using AND, OR, NOT, XOR and their negations — and generates the complete truth table along with the minterm list, while a gate reference shows the behaviour of each fundamental gate.
Boolean Algebra
Boolean algebra, formalised by George Boole, is the algebra of two values: true and false, or 1 and 0. Its operations — conjunction (AND), disjunction (OR) and negation (NOT) — obey laws analogous to ordinary algebra, including commutativity, associativity and distributivity, plus its own identities such as De Morgan’s laws, which state that the negation of an AND is the OR of the negations, and vice versa.
These laws are not academic curiosities; they are the everyday tools of circuit designers and programmers. Simplifying a Boolean expression with De Morgan’s laws can turn an expensive circuit into a cheap one, or make a tangled conditional in code clear and correct. Mastering Boolean algebra is essential for digital design, query optimisation, and writing precise logical conditions. Use the truth-table generator here to confirm that two expressions are equivalent by comparing their output columns.
Embedded Systems and Bit Manipulation
Embedded systems — the microcontrollers in cars, appliances, medical devices and IoT sensors — live and breathe at the bit level. With tightly constrained memory and processing power, embedded engineers routinely pack multiple flags into a single byte, read and write individual hardware register bits, and use bitmasks to configure peripherals. Setting bit 3 of a control register might enable an interrupt; clearing bit 7 might power down a sensor.
The common idioms are pure bitwise logic: OR with a mask to set bits, AND with an inverted mask to clear them, XOR to toggle them, and AND to test them. Getting these operations right is safety-critical in firmware. The Programmer mode and bit inspector in this toolkit are built for exactly this workflow, letting you construct masks, see the effect of each operation at the chosen width, and read off the resulting register value in binary and hex.
Programming Applications
Number systems and bit manipulation appear throughout everyday programming. Hexadecimal colour codes drive web design, bit flags compactly store sets of boolean options, and shifting and masking extract fields from packed data formats. Hashing, checksums, random number generation, and many algorithms rely on XOR and rotate operations. Even something as routine as checking whether a number is even reduces to inspecting its least significant bit.
Knowing how integers overflow, how signed and unsigned types differ, and how floating point rounds is what separates code that works by accident from code that is correct by design. Bugs caused by integer overflow, sign extension and floating-point comparison are among the most common and most subtle in software. The conversion, calculator and complement tools here let you reproduce and understand these behaviours precisely, and the API snippets show idiomatic conversion code in eight popular languages.
Cybersecurity Applications
Binary and hexadecimal are the working languages of cybersecurity. Reverse engineers read disassembled machine code in hex, malware analysts inspect file headers and shellcode byte by byte, and forensic investigators carve data out of raw disk images. Recognising magic bytes — the signature bytes at the start of a file, like 4D5A for a Windows executable or 89504E47 for a PNG — depends on fluency with hex dumps.
Cryptography is built on bitwise operations: XOR is the heart of stream ciphers and one-time pads, and rotations and shifts appear in nearly every hash function and block cipher. Entropy analysis, which measures the randomness of a byte stream, helps distinguish encrypted or compressed data from plain text and is a key heuristic for spotting packed malware. The file viewer and entropy analyser in this toolkit bring these techniques to your browser, processing files entirely locally so nothing ever leaves your device.
Data Storage and Binary
Everything a computer stores — text, images, audio, video, programs — is ultimately a sequence of bits on a storage medium. Storage capacity is measured in bytes and their multiples: a kilobyte is 1,024 bytes (2¹⁰), a megabyte 1,024 kilobytes, and so on, reflecting the binary nature of addressing. (Drive manufacturers often use decimal multiples of 1,000, which is why a “1 TB” disk shows less capacity in the operating system.)
File formats are conventions for arranging bytes so they can be interpreted correctly: a header describing the structure, followed by the data itself. Understanding how data is laid out in binary is essential for compression, serialization, database design and data recovery. The hex dump viewer here lets you peer directly at the raw bytes of any file, group and search them, and analyse their distribution — the same view used by professionals to diagnose corruption and understand unknown formats.
Machine Language
Machine language is the only language a CPU truly understands: raw binary instructions that directly control the processor. Each instruction is a specific pattern of bits encoding an operation (the opcode) and its operands. Assembly language gives these instructions human-readable mnemonics like MOV, ADD and JMP, but every assembly instruction maps to a precise binary encoding that the assembler produces.
High-level languages like Python or JavaScript are ultimately compiled or interpreted down to this machine code. Reading and writing it requires comfort with binary and hexadecimal, since instruction encodings, register numbers and memory offsets are all expressed in those bases. While most developers never write machine code by hand, understanding that it exists — and that all software bottoms out in patterns of bits — demystifies how computers actually run programs.
Binary in Real Life
Binary is not confined to computer science classrooms; it surrounds us. QR codes and barcodes encode data as patterns that are fundamentally binary. Braille uses a six-dot cell where each dot is present or absent — a binary pattern. Morse code, with its dots and dashes, is an early binary-like encoding. Even light switches, with their on and off states, embody the same two-state logic that powers every digital device.
In modern life, binary underlies your phone’s every photo, every streamed song, every text message and every banking transaction. The price displayed on a digital screen, the GPS coordinates guiding your car, and the firmware in your microwave are all sequences of bits being shuffled and transformed. Appreciating this hidden layer turns abstract technology into something concrete — and tools like this converter make that invisible binary world visible and interactive.
Common Conversion Examples
A few conversions come up so often they are worth memorising. The byte value 255 is FF in hex and 11111111 in binary — the maximum for eight bits. The value 256 needs nine bits: 100000000, or 100 in hex. The familiar 1024 (one kilobyte) is 10000000000 in binary and 400 in hex. The ASCII code for “A” is 65 (0x41, 1000001), and the space character is 32 (0x20).
In networking, the subnet mask 255.255.255.0 is /24 and translates to 24 leading 1-bits. The colour white #FFFFFF is three maxed-out bytes; black is #000000. Powers of two — 1, 2, 4, 8, 16, 32, 64, 128, 256 — are the backbone of computing because each is a single bit set in a different position. Working through examples like these in the converter builds the pattern recognition that makes binary second nature.
Best Practices
When working with number systems, always be explicit about the base. Use the conventional prefixes — 0b for binary, 0o for octal, 0x for hexadecimal — so values are never ambiguous. Be deliberate about bit width and signedness: a value that looks fine as an unsigned 8-bit number may be negative when interpreted as signed, and operations can overflow silently if you assume the wrong width.
For floating-point work, never compare values for exact equality; compare within a small tolerance instead, and prefer integer or decimal types for money. When manipulating bits, document what each flag means and use named masks rather than magic numbers. And when handling untrusted files, analyse them in a tool that runs locally — like this one — rather than uploading sensitive data to a remote server. Following these practices prevents the subtle, hard-to-find bugs that number-system mistakes so often cause.
Related Tools
More developer & conversion utilities you may find useful.
Frequently Asked Questions
What is binary?
Why do computers use binary?
How do I convert binary to decimal?
How do I convert decimal to binary?
How do I convert binary to hexadecimal?
How do I convert hexadecimal to binary?
How do I convert decimal to hexadecimal?
What is hexadecimal?
What is octal?
What is a bit?
What is a byte?
What is a nibble?
What is the largest number in 8 bits?
What is two’s complement?
What is one’s complement?
What is the difference between signed and unsigned numbers?
What is an integer overflow?
What is IEEE 754?
Why is 0.1 + 0.2 not equal to 0.3?
What is the mantissa in floating point?
What is the exponent bias?
How do bitwise operations work?
What is a bit shift?
What is the difference between logical and arithmetic shift?
What is a bit rotation?
What is a bitmask?
What is XOR used for?
What is ASCII?
What is Unicode?
What is the difference between Unicode and UTF-8?
How do I convert text to binary?
How do I convert binary to text?
What is Base64?
What is Base32 and Base36?
What is the difference between binary and a binary file?
How is an IP address related to binary?
What is a subnet mask?
What is CIDR notation?
How many usable hosts are in a subnet?
What is a MAC address in binary?
What is a truth table?
What is a logic gate?
What are universal logic gates?
What is Boolean algebra?
What are De Morgan’s laws?
What is entropy in a file?
What is a hex dump?
What are magic bytes?
What is the difference between KB and KiB?
How many bits are in a kilobyte?
What is endianness?
Can I convert between any two bases?
How large a number can this tool handle?
Does this converter work offline and keep my data private?
Can I convert a whole file to hex or binary?
Can I convert many numbers at once?
How do I round-trip a value through all bases?
What number systems did early computers use?
Is this tool suitable for students and educators?
What code can I use to convert numbers programmatically?
Built by the Omnitool Engineering Team
Our developer tools are used for millions of conversions a month, with a focus on correctness, arbitrary-precision maths and clear explanations.
Algorithms verified
Base conversion uses exact BigInt arithmetic; IEEE 754, two’s complement and subnet maths follow the published standards and are independently verifiable.
Last updated June 2026
Content and tooling are reviewed regularly to stay accurate and aligned with current standards and best practices.
Privacy & accuracy: Every conversion, calculation and file analysis runs entirely in your browser — no data, including uploaded files, is ever sent to a server. Integer conversions are exact at any size via BigInt; floating-point and width-limited operations follow standard 32/64-bit rules. This tool is provided for educational and engineering use; verify critical results against authoritative references.
Developer Calculators
Explore More Tools
Go ad-free & unlock more
- Zero ads, distraction-free workspace
- Unlimited saved results & favorites
- Branded PDF & Excel exports