Number Base Converter

Convert numbers between decimal, binary, octal, and hexadecimal instantly.

โœ“ Free ยท No sign-up ยท Works in browser

Use Number Base Converter

DECโ€”
BINโ€”
OCTโ€”
HEXโ€”

How to Use Number Base Converter

  1. Click the tab for the number base you are starting from: Decimal (base-10, everyday numbers), Binary (base-2, used in computing and digital systems), Octal (base-8, used in Unix file permissions and some legacy systems), or Hexadecimal (base-16, used in memory addresses, HTML colour codes, and machine code). Each tab opens an input field that accepts only valid digits for that base.

  2. Type or paste your number into the input field. The tool only accepts characters valid for the selected base: decimal allows 0โ€“9; binary allows only 0 and 1; octal allows 0โ€“7; hexadecimal allows 0โ€“9 and Aโ€“F (both upper and lowercase are accepted). An error message appears for invalid characters โ€” this prevents silent conversion errors that could happen with malformed input.

  3. The converted values for all four bases appear instantly in the output panel without clicking any button. For example, entering decimal 255 immediately shows binary 11111111, octal 377, and hexadecimal FF. All four representations are always displayed together so you can cross-reference without switching between views or recalculating.

  4. Click the 'Copy' button next to any output value to place that specific representation on your clipboard. Use this when working with HTML colour codes (copy the hex value), when writing Unix file permission scripts (copy the octal value), when configuring binary flags or bitmasks in code (copy the binary value), or when working with any system that requires a specific representation of the same number.

  5. For hexadecimal output specifically, the result is displayed in uppercase (Aโ€“F) without a prefix. If your target system requires a prefix โ€” '0x' for C/C++/Python/JavaScript, '#' for HTML colour codes (for 6-digit hex colour values only), or '&H' for Visual Basic โ€” add the prefix manually after copying. The conversion itself is the same regardless of what prefix convention your environment expects.

About Number Base Converter

The Base Converter translates numbers between the four numeral systems that appear most frequently in computing and electronics: decimal (base-10), binary (base-2), octal (base-8), and hexadecimal (base-16). Select the base of your input, type a value, and all four representations appear simultaneously โ€” no back-and-forth, no recalculating, no memorising conversion formulas.

Binary, octal, and hexadecimal each serve specific purposes in computing. Binary is the native language of digital hardware โ€” every piece of data stored or transmitted by a computer is ultimately a sequence of binary digits. Octal provides compact notation for Unix file permissions: each octal digit represents one group of three binary bits. Hexadecimal is the preferred notation for memory addresses, machine code, and HTML colour values because one hex digit represents exactly four binary bits, keeping long binary values legible.

All four representations are displayed simultaneously in the output panel rather than one at a time. This lets you verify that the same number expressed differently is indeed the same value โ€” a useful sanity check when working with colour codes, bitmask flags, or permission settings where a misread digit has significant consequences. The per-format copy buttons place only the specific representation you need on the clipboard, ready to paste directly into a stylesheet, shell command, or code editor.

All conversions run entirely in the browser using standard JavaScript integer arithmetic. No data is transmitted to any server. The tool works offline once the page is loaded and has no usage limits. Input validation prevents invalid characters for each base from being entered, which avoids the conversion errors that arise when characters outside the valid digit set are silently ignored by some parsers.

Tips & Best Practices for Number Base Converter

  • ๐Ÿ’กEnable "Show Steps" to see the full division-remainder working for each conversion โ€” this is essential when practising for GATE, university exams, or placement tests that require you to show the conversion method alongside the final answer.
  • ๐Ÿ’กUse the nibble grouping option for binary output โ€” large binary numbers grouped in sets of 4 bits (nibbles) are much easier to verify manually and directly correspond to hex digits (4 bits = 1 hex digit).
  • ๐Ÿ’กFor hexadecimal output, prefer uppercase A-F in professional programming contexts (CSS colour codes, memory addresses in documentation) and lowercase a-f in code strings where lowercase is more readable.
  • ๐Ÿ’กVerify your manual calculation against the converter for GATE practice โ€” if your calculated binary output for a given decimal does not match the converter, trace back through the division steps shown in "Show Steps" to find the error.
  • ๐Ÿ’กUse the custom base option (Base 36) for URL shortener and alphanumeric ID generation scenarios โ€” Base 36 (digits 0-9 plus letters a-z) is a compact encoding widely used in short URL tokens and database ID obfuscation.
  • ๐Ÿ’กFor fractional binary conversion (decimal points), take your time verifying the repeated multiplication steps โ€” fractional conversions are the most error-prone part of number system questions in competitive examinations.

Common Mistakes to Avoid with Number Base Converter

  • โœ•Entering invalid digits for the selected input base โ€” only digits 0-1 are valid in binary, 0-7 in octal, 0-9 in decimal, and 0-9 and A-F in hexadecimal. Entering "9" in a binary input or "G" in a hex input is an error the converter will flag.
  • โœ•Reading the division-remainder steps in the wrong direction โ€” when converting decimal to binary using repeated division, the binary number is read from the last remainder to the first (bottom to top). Reading top-to-bottom gives the wrong answer.
  • โœ•Confusing hexadecimal digit values โ€” A=10, B=11, C=12, D=13, E=14, F=15. A common mistake is treating hex A as 1 rather than 10 when doing manual conversions from hex to decimal.
  • โœ•Attempting to convert a negative number without understanding how two's complement works โ€” the base converter handles positive integers. Negative number representation in binary (two's complement) requires additional steps not handled by a simple base converter.
  • โœ•Applying integer conversion steps to fractional numbers โ€” fractional parts of a number (everything after the decimal point) require the repeated multiplication method, not the repeated division method used for integer parts.
  • โœ•Not using groupings when verifying hex-to-binary conversions โ€” always convert each hex digit to its 4-bit binary equivalent individually and concatenate (e.g., hex 2FA = 0010 1111 1010 in binary). Missing leading zeros in any group is a common error.

Frequently Asked Questions

What is a number base and why are binary, octal, and hex used in computing?
A number base (or radix) defines how many unique digits a positional numeral system uses. Decimal (base-10) uses 0โ€“9 because humans evolved counting on ten fingers. Binary (base-2) uses only 0 and 1 because transistors in computers have two states: off and on. Octal (base-8) and hexadecimal (base-16) are shorthand for binary: every octal digit represents exactly 3 binary digits, and every hex digit represents exactly 4 binary digits. This makes hex especially compact โ€” the 8-bit byte value 11111111 in binary is simply 'FF' in hex. Computer science uses these bases constantly for memory addresses, colour values, bitmasks, and machine code.
How do I convert a number manually to verify the tool?
To convert decimal 42 to binary: repeatedly divide by 2 and record remainders from bottom to top โ€” 42รท2=21r0, 21รท2=10r1, 10รท2=5r0, 5รท2=2r1, 2รท2=1r0, 1รท2=0r1 โ†’ read remainders upward: 101010. To convert binary to decimal: each bit position from right represents a power of 2 โ€” 101010 = (1ร—32)+(0ร—16)+(1ร—8)+(0ร—4)+(1ร—2)+(0ร—1) = 32+8+2 = 42. For hex, each digit represents 4 bits: 'A' = 10, 'B' = 11, up to 'F' = 15. Hex 'FF' = (15ร—16) + 15 = 240 + 15 = 255 decimal.
Why is hexadecimal used for HTML and CSS colour codes?
HTML/CSS colour codes like #3B82F6 (Tailwind CSS blue-500) are 6-digit hexadecimal values representing three 2-digit hex pairs: one each for red (3B), green (82), and blue (F6). Each pair covers 0โ€“255 โ€” the full range of an 8-bit colour channel. Hex is used because it compactly represents 24 bits of colour information in just 6 characters. The same value in decimal would be rgb(59, 130, 246) โ€” slightly longer. Designers and front-end developers encounter hex colour codes constantly in CSS, SVG, HTML, Figma exports, and design token files. Pasting a hex value into a colour picker requires knowing exactly what the digits represent.
What are Unix file permissions and why do they use octal?
Unix and Linux file permissions are expressed as three groups of three bits: read (r=4), write (w=2), execute (x=1) for owner, group, and others. Adding these within each group gives a single digit 0โ€“7 โ€” an octal digit. The permission 'rwxr-xr-x' translates to 7 (rwx), 5 (r-x), 5 (r-x), represented as octal 755. The chmod 755 command on a shell sets these permissions. Octal is a natural fit because each octal digit maps exactly to one 3-bit permission group. Understanding binary-to-octal conversion (or using this calculator) helps when reading or writing chmod commands in scripts and server configuration.
Is there a maximum input size the converter handles?
The converter uses JavaScript's native parseInt() and toString() functions, which handle integers accurately up to 2^53 โˆ’ 1 (Number.MAX_SAFE_INTEGER = 9,007,199,254,740,991 in decimal). For inputs within this range, all four base conversions are exact. For very large binary strings โ€” more than 53 bits โ€” JavaScript's floating-point representation loses precision and results may be incorrect. Most practical computing tasks (byte values, port numbers, IP octets, HTML colours, Unix permissions, small memory addresses) fall well within safe integer range and convert accurately. For cryptographic keys, large memory addresses, or 64-bit values, use a language-native bigint implementation instead.
How does this convert hexadecimal letters โ€” are Aโ€“F case sensitive?
The input field for hexadecimal accepts both uppercase and lowercase letters โ€” 'a' through 'f' and 'A' through 'F' are treated as equivalent and convert to the same value. For example, 'ff', 'FF', and 'fF' all parse as decimal 255. The output is always displayed in uppercase (FF) for readability and consistency with conventions in most technical documentation, memory dump utilities, and processor specifications. If you paste a lowercase hex string from a CSS colour value or a Python hex literal, the converter accepts it without modification and outputs the uppercase equivalent.