🔄 Number Base Converter

Ad Space - Top (728×90)

Input Data

Binary

Results will appear here...

Hexadecimal

Results will appear here...

Octal

Results will appear here...

Decimal

Results will appear here...

Converted Text

Results will appear here...
Ad Space - Middle (728×90)

Number Base Conversion Guide

What is a Number Base?

A number base (or radix) is a system of representing numbers using a specific set of symbols. Different bases use different numbers of symbols. The most common is decimal (0-9), but in computer science, binary (0 and 1), octal (0-7), and hexadecimal (0-9, A-F) are equally important.

Characteristics of Each Base

Binary (Base 2): Uses only 0 and 1, representing the lowest-level computer data. Each binary digit is called a bit, and 8 bits form 1 byte. Binary directly corresponds to the on/off states of computer hardware and is the foundation of programming and hardware debugging.

Octal (Base 8): Uses the digits 0-7. In early Unix systems, file permissions (like 755, 644) were represented in octal. While less common today than hexadecimal, it still finds application in certain embedded systems and permission settings.

Decimal (Base 10): Uses the digits 0-9, the system we use in everyday life. In computing, decimal is typically used to represent ASCII code values, where each character corresponds to a decimal number from 0 to 127.

Hexadecimal (Base 16): Uses the symbols 0-9 and A-F. Since every 4 binary bits can be represented by exactly 1 hexadecimal character, hex is the most compact way to represent binary data. It is widely used for memory addresses, color values (like #FF5733), hash values, and more.

How to Use

This number base converter is simple yet powerful. Here is the detailed usage guide:

Step 1: Select Input Format. In the "Input Format" dropdown, choose the type of data you are entering. If you are entering plain text (such as English, Chinese, etc.), select "Plain Text". If you are entering binary, hexadecimal, octal, or decimal data, select the corresponding format.

Step 2: Enter Data and Select Encoding. Type your data in the text box. If it is text data, please select the correct character encoding (UTF-8, ASCII, or UTF-16). UTF-8 is the default and recommended encoding, supporting all Unicode characters. If you are processing pure English text, ASCII encoding will be more compact.

Step 3: Click Convert. After clicking the "Convert All" button, the tool will automatically convert the input data into all other formats (binary, hexadecimal, octal, decimal, and plain text), displaying them simultaneously in the result cards below. You can copy the result of any individual format, or reload any format back into the input box for further conversion.

Advanced Options: You can check "Add space separators" to make the results more readable, or check "Add prefixes" to include standard prefixes like 0x for hex, 0b for binary, and 0o for octal.

Use Cases

The number base converter has wide applications in programming and computer science. Here are some typical use cases:

Debugging Binary Data: In embedded development, communication protocol analysis, and network packet inspection, you often need to view and analyze raw binary data. For example, when parsing a network packet, you can convert a hexadecimal dump to binary to analyze the meaning of each bit, or convert binary data to ASCII text to view any readable content.

Color Value Conversion: In web development, colors are often represented in hexadecimal (like #FF5733). Using this tool, you can quickly convert a hex color value to decimal or binary to understand its internal representation. For example, #FF5733 corresponds to the decimal RGB value (255, 87, 51).

Learning Computer Fundamentals: Beginners in computer science often need to understand the relationships between different number bases. With this tool, you can quickly verify whether your manual base conversion results are correct, deepening your understanding of binary, hexadecimal, and other concepts. For example, converting the decimal number "255" to hexadecimal yields "FF", which corresponds to the maximum value of a single byte.

Data Encoding and Decoding: In certain special scenarios, text data needs to be converted to binary or hexadecimal for transmission or storage. For example, converting a piece of text to hexadecimal before embedding it in a QR code, or converting binary data to ASCII text for debugging. This tool supports bidirectional conversion to meet various encoding and decoding needs.

Extended Knowledge

Mathematical Principles of Base Conversion: Conversion between different bases is based on exponentiation. To convert decimal to binary, repeatedly divide the number by 2 and record the remainders, then reverse the sequence of remainders. For example, decimal 13: 13÷2=6 remainder 1, 6÷2=3 remainder 0, 3÷2=1 remainder 1, 1÷2=0 remainder 1. Reversed, the binary result is 1101.

UTF-8 Encoding Principles: UTF-8 is a variable-length encoding scheme that uses 1-4 bytes per character. ASCII characters (0-127) use 1 byte, common characters like Chinese use 3 bytes, and special characters like Emoji use 4 bytes. This allows UTF-8 to support all languages globally while maintaining compatibility with ASCII.

Number Bases in Computing: Operating systems use octal for file permissions (e.g., chmod 755); memory addresses and MAC addresses use hexadecimal; IP addresses (like 192.168.1.1) use dotted decimal; network protocols (like TCP headers) use numerous binary flag bits. Understanding the application scenarios of these bases is an important foundation for becoming a competent developer.

Standard Number Prefixes: In programming, different bases have standard prefix notations: binary uses 0b (e.g., 0b1010 represents decimal 10), octal uses 0o (e.g., 0o12 represents decimal 10), and hexadecimal uses 0x (e.g., 0xFF represents decimal 255). This tool optionally supports outputting these standard prefixes.

What is the difference between binary, octal, decimal, and hexadecimal?

They are different numeral systems using different numbers of symbols. Binary uses only 0 and 1, representing the lowest-level computer data. Octal uses 0-7 and was common in early Unix systems. Decimal uses 0-9, the system we use in daily life. Hexadecimal uses 0-9 and A-F, widely used in programming for memory addresses, color values, and hash representations because it compactly represents binary data.

Which encoding formats does this tool support?

The tool supports UTF-8 (default), ASCII, and UTF-16 encoding formats. UTF-8 is the standard encoding for modern Web and supports all Unicode characters including Chinese and Emoji. ASCII encoding only supports 128 standard characters, suitable for pure English scenarios. UTF-16 supports a broader range of Unicode characters and is used in specific scenarios such as Windows APIs and Java internal strings.

Why are there spaces in the converted result?

By default, the tool inserts a space after every 8 bits (one byte) in binary, octal, and hexadecimal results for better readability. You can disable this in the options. Spaces are for display only and are automatically removed when copying.

Can the converted data be reversed back to the original text?

Yes. As long as the same encoding format (e.g., UTF-8) is used, binary/hex/octal/decimal data can be perfectly restored to the original text. However, if the text contains multi-byte characters (such as Chinese), make sure to use UTF-8 encoding rather than ASCII encoding, or garbled text may occur.

Is this tool free to use?

Yes, completely free. All conversions are performed locally in your browser. No data is uploaded to any server, protecting your privacy.

How do I convert a hex color value?

Enter the hex color value in the input box (like FF5733 or #FF5733), select "Hexadecimal" as the input format, and click Convert. In the results, you will see the corresponding decimal RGB values (255, 87, 51) and binary values. Conversely, you can also convert decimal RGB values back to a hex color value.

Ad Space - Bottom (728×90)