Convert integers between number bases
Convert binary, octal, decimal and hexadecimal values. Spaces and underscores used only as visual separators are accepted.
What is a number base?
A positional numeral system uses a radix, or base, to determine how many digit symbols are available and the value of each position. Decimal uses base 10. Binary uses base 2, octal uses base 8 and hexadecimal uses base 16. The written digits change, but the underlying integer value does not.
Binary: the natural representation of bits
Binary has only the digits 0 and 1. Each position is a power of two. For example, 11111111₂ equals 255₁₀. Binary is fundamental when studying bit masks, flags, registers, digital logic, permissions, addressing and low-level protocols.
Octal: compact groups of three bits
One octal digit represents exactly three binary bits because 8 = 2³. Octal remains especially visible in Unix-style permission notation: the read, write and execute bits form three-bit groups that map naturally to digits from 0 through 7.
Decimal: the everyday positional system
Decimal uses digits 0 through 9. Each position represents a power of ten. The value 255, for example, is 2×10² + 5×10¹ + 5×10⁰. Conversion does not change the quantity itself; it changes only the notation used to express it.
Hexadecimal: four bits per digit
Hexadecimal uses 0–9 followed by A–F for values ten through fifteen. Since 16 = 2⁴, every hexadecimal digit corresponds exactly to four binary bits. This makes hexadecimal much more compact than raw binary while preserving easy bit-level conversion.
Prefixes identify notation, but conventions vary
The prefixes 0b and 0x are widely used to indicate binary and hexadecimal notation, while 0o is a clear modern notation for octal in several environments. Syntax is language-dependent: some C-derived contexts historically use a leading zero for octal, and shell arithmetic has its own base notation rules. This converter accepts 0b, 0o and 0x only when they match the selected source base.
Why hexadecimal and binary matter in networking
Networking frequently exposes values at multiple representation levels. Subnet masks and prefix calculations are easier to understand in binary, while IPv6 addresses and protocol fields are commonly written in hexadecimal. Base conversion is therefore useful for learning how the same bits can be represented in different human-readable forms.
Hexadecimal is common in debugging and low-level work
Memory addresses, masks, protocol fields, byte dumps, machine-level data and register values are frequently shown in hexadecimal because each hex digit maps cleanly to four bits. Octal remains relevant in Unix permissions, while binary is valuable when individual flags and bit positions matter.
Why this converter does not use PHP base_convert()
PHP documents that base_convert() may lose precision with large values because of properties related to its internal floating-point handling. This page instead performs integer conversion directly on strings using long division. That allows very large non-negative integers without requiring GMP or BCMath; the 10,000-character limit is an operational limit of this web tool, not a mathematical limit of the algorithm.
Number-base conversion is different from Base64
Although the names look similar, converting the integer 255 from decimal to hexadecimal (FF) is not the same operation as Base64 encoding data. Base64 is a binary-to-text encoding designed to represent arbitrary byte sequences using a restricted text alphabet. A radix converter represents a numeric value in another positional numeral system.
Base conversion does not change byte order
Endianness describes how the bytes of a multi-byte value are ordered in memory or a byte stream. It is a separate concept from radix. Converting 305419896₁₀ to 12345678₁₆ changes its textual representation; it does not by itself reorder the bytes as little-endian or big-endian.