Number Base Converter Guide
Number Base Converter handles a conversion every programmer eventually needs but rarely needs often enough to memorize: translating a number between decimal (base 10, what humans use day to day), binary (base 2, what computers fundamentally operate on), hexadecimal (base 16, the common shorthand for binary used throughout programming, from color codes to memory addresses), and octal (base 8, less common today but still found in file permission notations like 755). Doing this conversion by hand is straightforward in principle but tedious and error-prone in practice, especially for anything beyond a small number, which is exactly the kind of repetitive arithmetic a tool should handle instead.
This tool converts a number from any base between 2 and 36 into any other base in that same range, entirely in your browser using JavaScript's built-in number parsing. Beyond the four common bases, supporting the full range up to base 36 covers more specialized cases too, like base-36 encoding sometimes used to produce compact, URL-friendly representations of large numbers using digits and letters together.
Understanding what a number actually means depends entirely on knowing its base, which is why programming languages and documentation use prefixes and suffixes to disambiguate — 0x for hexadecimal, 0b for binary, a trailing 'o' or 0o prefix for octal — since the digit sequence "10" means something completely different depending on whether it's read as decimal ten, binary two, or hexadecimal sixteen. This tool sidesteps that ambiguity by having you explicitly select both the source and target base rather than guessing from context.
This conversion comes up constantly in low-level programming, debugging memory addresses or bit flags, working with color codes that mix hex and decimal representations, and any context where a value needs to move between a human-friendly decimal representation and the binary or hexadecimal form a computer or specification actually expects.
How to convert between number bases
- Enter your number. Type in the exact number you actually want to convert. Make sure you're entering only digits and letters that are actually valid for the source base you're about to select — for example, binary only uses 0 and 1, so entering a digit like 5 wouldn't make sense as binary input and would be rejected or flagged as invalid. Spaces, commas, or other separators sometimes used to group digits visually should generally be removed first, since the parser expects a clean, continuous sequence of valid digits for the chosen base. Most modern browsers and operating systems make this kind of text entry straightforward, and the tool typically validates the input immediately, giving instant feedback if something doesn't match the expected character set for the base you've chosen.
- Select the source base. Choose precisely the base your entered number is currently actually written in — decimal, binary, hexadecimal, octal, or quite literally any other valid base between 2 and 36. Getting this right matters enormously, since the same digit sequence represents a completely different actual value depending on which base it's interpreted in. This mistake is easy to make when copying a number from documentation or code without noticing which base it was actually written in, so double-checking the source context before selecting is worthwhile. It's worth taking an extra moment here particularly when working from a value pasted out of a technical specification, a hardware datasheet, or an unfamiliar codebase, where the convention for indicating base might not be immediately obvious from the surrounding context alone.
- Select the target base. Choose the exact target base you want the number ultimately converted into. You can select any combination of source and target base, including converting directly between two unusual bases rather than always routing through decimal, even though decimal is what the conversion uses internally as a common intermediate step. Going through decimal as an intermediate step internally doesn't introduce any rounding or precision loss for ordinary integer values, so the result is exactly as accurate as a direct conversion would be.
- Review the converted result. Carefully check the resulting output value in your chosen target base. For hexadecimal output specifically, confirm carefully whether you actually need uppercase or lowercase letters for digit values above 9, since both forms are equally valid representations of the exact same numeric value and some systems are quite particular about exactly which convention they actually expect to see. This distinction rarely matters for the underlying numeric value itself, but it can matter for matching a specific style guide or an existing codebase's established convention for hexadecimal formatting.
- Copy the result for use elsewhere. Copy the freshly converted number directly into your code, your configuration, or your documentation. Double-checking the final result against a known reference value, if you happen to have one handy, is a reasonable sanity check the first time you're converting into or out of an unfamiliar base. This is especially worth doing the first few times you work with an unfamiliar base, since building confidence in the tool's correctness for your specific use case pays off across every future conversion.
Use Cases
- Converting a hexadecimal color code to decimal RGB: Convert each hexadecimal pair in a color code like #FF8800 into its decimal equivalent to understand the actual red, green, and blue intensity values.
- Debugging a memory address or bit flag: Convert a hexadecimal memory address or binary bit flag into decimal to make sense of it during low-level debugging.
- Understanding Unix file permission notation: Convert an octal permission value like 755 into binary to see exactly which read, write, and execute bits are actually set.
- Encoding a large number compactly for a URL: Convert a large decimal number into base-36 to produce a shorter, URL-friendly string representation using digits and letters.
- Verifying a binary literal in code: Convert a binary literal used in source code into decimal to confirm it represents the exact numeric value the code is intended to use.
- Learning how different number bases work: Experiment with converting the same number across several bases to build an intuitive understanding of how positional numeral systems actually function.
About This Tool
What is it? A browser-based tool that converts numbers between any two bases from 2 to 36, including binary, octal, decimal, and hexadecimal, without uploading anything to a server.
Why use it? It eliminates manual, error-prone arithmetic when translating a number between bases, which comes up constantly in low-level programming, color codes, and file permission notation.
Alternatives: Most programming languages have built-in functions for base conversion, the right approach inside actual code; this tool is for the many situations outside of code — reading documentation, debugging by eye, quick manual checks — where running a script for one conversion would be overkill.
Common mistakes: Forgetting to specify the correct source base and having the tool misinterpret the input entirely is the most common mistake, since the same digit sequence can be a valid number in several different bases simultaneously; the second is confusing uppercase and lowercase hexadecimal letters when a system specifically expects one or the other.
Frequently Asked Questions
- Is my number uploaded to a server during conversion?
- No, the conversion happens entirely in your browser using JavaScript; nothing is transmitted anywhere.
- What letters are used for digits above 9 in higher bases?
- Letters A through Z represent values 10 through 35, which is what allows bases up to 36 to be represented using only the standard alphanumeric characters.
- Why does the same digit sequence mean different things in different bases?
- A number's value depends on the positional weight of each digit, which is determined by the base — the digits "10" mean ten in decimal but only two in binary, since the value of each position scales with the base.
- Can I convert directly between two unusual bases, like base 7 to base 13?
- Yes, you can select any source and target base combination in the supported range; the tool handles the conversion the same way regardless of which two bases are involved.
- Is there a limit on how large a number I can convert?
- Very large numbers may be affected by the precision limits of JavaScript's native number handling; for most everyday conversions this isn't a practical concern, but extremely large values may need special handling.
- Why do negative numbers need special handling in binary?
- Computers typically represent negative binary numbers using a scheme called two's complement rather than a simple minus sign, which is a separate consideration from straightforward base conversion of a positive value.
- What's the difference between 0x and 0b prefixes?
- 0x indicates the number that follows is hexadecimal, while 0b indicates binary; these prefixes are a programming convention for disambiguating a number's base when it appears in code rather than being inherent to the number itself.
- Does this tool handle fractional or decimal-point numbers?
- This tool is built around whole, integer values; converting fractional numbers between bases is a more specialized case that typically requires separately handling the integer and fractional parts.