How do I convert numbers between binary, decimal, and hexadecimal?
Enter a number in any base — binary, octal, decimal, or hexadecimal — and instantly see it converted to all other bases. The tool handles large numbers and updates in real time as you type. Everything runs in your browser.
255
Hex: FF Binary: 11111111 Octal: 377
Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal. Results update as you type.
About Number Base Conversion
- Supports arbitrarily large numbers using BigInt — no precision loss.
- Use prefixes for quick input:
0bfor binary,0ofor octal,0xfor hex. - Underscores in input are ignored for readability (e.g.
1_000_000). - Everything runs in your browser — no data is sent over the network.
Tips & Best Practices
Use hex for colors and memory addresses, binary for bit flags
Each number base has its sweet spot: hexadecimal for colors (#FF5733), memory addresses, and byte values. Binary for bitwise operations and feature flags. Octal for Unix file permissions (chmod 755). Decimal for everything humans need to read.
JavaScript parseInt() defaults to base 10, not auto-detect
parseInt('010') returns 10 in modern JS (base 10), but returned 8 in older engines (octal). Always specify the radix: parseInt('0xFF', 16) for hex, parseInt('111', 2) for binary. The implicit radix has caused countless subtle bugs.
Hex is just a compact way to write binary
Each hex digit maps to exactly 4 binary bits: 0xF = 1111, 0xA = 1010. This makes hex ideal for reading binary data — a 32-bit value like 11111111000000001010101001010101 becomes FF00AA55, which is actually readable.
Validate numeric inputs to prevent injection via unusual bases
Attackers sometimes bypass input validation by encoding payloads in hex (0x) or octal (0). Ensure your input parsing handles all numeric representations consistently and doesn't accidentally interpret user input as a different base.
Frequently Asked Questions
How do I convert between decimal, binary, octal, and hexadecimal?
Why do programmers use hexadecimal instead of binary?
How do I convert a negative number to binary?
Related Convert Tools
OpenAPI to TypeScript
Convert OpenAPI 3.x and Swagger 2.0 specs to TypeScript interfaces and types with $ref resolution, allOf/oneOf/anyOf, enums, and API operation types
JSON to Zod Converter
Convert JSON or JSON Schema to Zod validation schemas with $ref resolution, allOf/oneOf/anyOf, enum, format constraints, and required/optional fields
GraphQL to TypeScript
Convert GraphQL SDL schemas to TypeScript interfaces, types, enums, unions, and operations
TypeScript to JavaScript
Convert TypeScript to JavaScript — strip types, interfaces, enums, generics, and access modifiers to get clean JS output