Integer base converter

Convert a number between different bases (decimal, hexadecimal, binary, octal, base64, ...)

Enable JavaScript to use the interactive tool. The guide below explains how it works.

Integer Base Converter: Advanced Positional Notation Guide

What the tool does

The Integer Base Converter is a high-precision utility designed to translate numeric values between different positional numeral systems. While most people are familiar with the decimal (base 10) system used in daily life, computing and mathematics rely heavily on other bases like binary (base 2), octal (base 8), and hexadecimal (base 16).

This tool allows users to input a number in any base from 2 to 64 and instantly see its representation in several standard formats, as well as a user-defined custom base. It handles large integers with ease and provides a clean, reactive interface where changes to the input or the base are reflected across all output fields in real-time. The converter supports a wide character set for higher bases, using standard alphanumeric mapping (0-9 followed by A-Z and a-z) to represent digit values greater than 9.

Why someone uses it

The need to convert numbers between bases is a fundamental requirement in computer science, digital electronics, and cryptography.

1. Low-Level Programming and Debugging

Embedded systems and kernel developers frequently work with binary and hexadecimal. Hexadecimal is particularly useful as a shorthand for binary, where every two hex digits represent exactly one byte (8 bits). This tool makes it easy to translate memory addresses or bitwise flags into a human-readable decimal form or vice-versa.

2. Networking and Protocol Analysis

Network engineers often need to convert between dotted-quad IPv4 addresses and their raw 32-bit binary or decimal equivalents. Understanding the binary structure of an integer is key to mastering subnet masks and CIDR notation.

3. Data Encoding (Base64)

In web development, binary data is often encoded as Base64 strings to be safely transmitted over text-based protocols like HTML or JSON. This converter allows developers to see the numeric value behind these encodings, which is essential for understanding data serialization.

4. Mathematical Exploration

Educators and students use base conversion to understand the mechanics of positional notation. It helps visualize how the "value" of a digit is determined by its position and the base of the system.

Step-by-step instructions

  1. Locate the Converter: Open the "Integer base converter" tool from the main menu.
  2. Enter the Input Number: In the "Input number" field, type the value you want to convert.
    • Note: Ensure the characters you use are valid for your chosen input base (e.g., don't use '9' in a base 8 input).
  3. Define the Input Base: Set the "Input base" using the numeric stepper. This defaults to 10 (decimal). You can select any base between 2 and 64.
  4. Observe the Outputs: The tool will automatically update the following fields:
    • Binary (2): The base-2 representation (0s and 1s).
    • Octal (8): The base-8 representation.
    • Decimal (10): The standard base-10 representation.
    • Hexadecimal (16): The base-16 representation (0-9, A-F).
    • Base64 (64): The base-64 representation using the standard 64-character set.
  5. Custom Base Conversion: If you need a specific base not listed (like base 12 or base 36), use the "Custom" section at the bottom. Adjust the numeric base value, and the corresponding representation will appear in the adjacent text box.
  6. Copy Results: Click the "Copy" button next to any output field to save that specific conversion to your clipboard.

Examples

Example 1: Decoding Hexadecimal

Example 2: Converting Decimal to Binary

Example 3: Using a Custom Base (Base 36)

FAQs

Q: What is the maximum base supported?

A: This tool supports up to Base 64. This includes the standard digits 0-9, uppercase A-Z, lowercase a-z, and two additional characters (+ and /) typically used in Base64 encoding.

Q: Why does it say "Invalid characters for base"?

A: If you set the input base to 2 (binary) but type the number "123", the tool will show an error because "2" and "3" are not valid digits in binary.

Q: Does this tool handle negative numbers?

A: The current implementation is optimized for non-negative integers. For signed integers, users typically work with two's complement representations in binary.

Q: Is there a limit to how large the number can be?

A: The tool uses high-precision arithmetic, allowing it to handle numbers much larger than the standard 32-bit or 64-bit integer limits found in many programming languages.

Q: What character set is used for bases above 10?

A: The standard mapping is:

Common mistakes

1. Misidentifying the Input Base

The most common error is leaving the input base at 10 while pasting a hexadecimal or binary number. Always set the "Input base" first.

2. Confusing Base64 Encoding with Base 64 Conversion

While this tool performs mathematical base-64 conversion, "Base64 Encoding" (used for files/images) often involves padding (=) and is applied to raw bytes rather than a single large integer. For converting files, use the "Base64 File Converter" tool.

3. Case Sensitivity in High Bases

In bases between 11 and 35, the tool is generally case-insensitive (A=a). However, in Base 64, 'A' and 'a' represent completely different values (0 and 26 respectively). Pay close attention to case when working with bases above 36.

4. Overlooking Leading Zeros

In positional notation, leading zeros don't change the value (e.g., 00101 is the same as 101). If you need a specific bit-width (like an 8-bit binary string), you may need to manually pad the result.

Use cases

Related tools

All tools

Guides and articles