Number Base Converter

二进制、八进制、十进制、十六进制互转。

4 Bases

Binary, Octal, Decimal, Hexadecimal.

BigInt Support

Handles arbitrarily large numbers.

Copy Result

One-click copy to clipboard.

Client-side

All processing in your browser. No data uploaded.

关于Number Base Converter

Number base conversion is a fundamental concept in computer science and digital electronics. While humans naturally use base-10 (decimal), computers internally represent all data in base-2 (binary). Programmers and engineers regularly need to switch between four key number bases: binary (base-2, using digits 0–1), octal (base-8, using digits 0–7), decimal (base-10, using digits 0–9), and hexadecimal (base-16, using digits 0–9 and A–F). Hexadecimal is especially prevalent in web colours (#FF5733), memory addresses, byte representations, and debugging output because each hex digit maps exactly to four binary bits, making it far more compact than binary. This converter accepts a number in any of the four bases and instantly shows the equivalent value in all other bases. It uses JavaScript BigInt internally, so it correctly handles arbitrarily large numbers that exceed standard 64-bit floating-point precision — you can convert numbers with hundreds of digits without loss. Each result includes the standard notation prefix (0b for binary, 0o for octal, 0x for hexadecimal) and a one-click copy button.

如何使用Number Base Converter

  1. Select the base of the number you want to enter: Binary, Octal, Decimal, or Hexadecimal.
  2. Type your number into the input field. Valid characters are shown based on the selected base (e.g., only 0 and 1 for binary).
  3. All four base representations appear instantly in the results panel below.
  4. The currently selected input base is highlighted in the results for easy reference.
  5. Click the Copy button next to any result to copy just that value to your clipboard.
  6. Switch between bases at any time — the input clears automatically to prevent invalid entries.

常见问题

Why is hexadecimal so common in programming?

Each hexadecimal digit represents exactly 4 binary bits (a nibble), so a byte (8 bits) can be written as exactly 2 hex digits. This makes hex far more compact and readable than binary, which is why it appears in colour codes, memory addresses, and binary file formats.

What is the largest number this tool can handle?

This tool uses JavaScript's BigInt type, which can represent integers of arbitrary size. There is no practical upper limit on the number of digits you can convert.

How do I convert a negative number?

This tool currently handles non-negative integers. For negative numbers in binary you would typically use two's complement representation, which depends on the bit width (8, 16, 32, 64 bits) — a more specialised tool is needed for that.

What are the valid characters for each base?

Binary accepts only 0 and 1. Octal accepts 0–7. Decimal accepts 0–9. Hexadecimal accepts 0–9 and A–F (or a–f — both are accepted and results are shown in uppercase).

Why does the prefix 0x, 0b, or 0o appear in the results?

These are standard programming notation prefixes: 0x denotes hexadecimal, 0b denotes binary, and 0o denotes octal. They are used in most programming languages (JavaScript, Python, C, etc.) to distinguish numeric literals from decimal numbers.

相关工具

Hash GeneratorBase64 Encoder/DecoderTimestamp ConverterUUID GeneratorJSON Formatter
Free Ebook
Top 10 Free Tools Every Developer Needs

Top 10 Free Tools Every Developer Needs

Boost your productivity instantly. Get our exclusive cheatsheet featuring the most essential web utilities you didn't know you needed, delivered straight to your inbox.

We respect your inbox. Unsubscribe at any time.