DevTools Logo

Number Base Converter

Number Base Converter

Convert numbers between Binary, Octal, Decimal, and Hexadecimal formats instantly

Decimal

Hexadecimal

0x

Binary

Octal

Quick Values

Examples

Convert decimal 255

Input
Decimal: 255
Output
Hexadecimal: FF
Octal: 377
Binary: 11111111

255 is one less than 256, so its binary form is eight 1 bits and its hexadecimal form is FF.

Convert decimal 42

Input
Decimal: 42
Output
Hexadecimal: 2A
Octal: 52
Binary: 101010

The same integer is represented with different digit sets and place values in each radix.

Convert decimal 1024

Input
Decimal: 1024
Output
Hexadecimal: 400
Octal: 2000
Binary: 10000000000

1024 is 2^10, so its binary representation is a 1 followed by ten zeros.

About this tool

The Number Base Converter keeps four integer representations synchronized: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Enter a value in any field and the tool parses it in that field's radix, then immediately fills the other three representations. Hexadecimal output uses uppercase A–F.

Common 0b, 0o, and 0x prefixes are stripped before parsing, and the hexadecimal field displays its own 0x prefix separately. The converter is intended for whole-number notation; it does not model a fixed bit width, fractional values, signed encodings, or two's-complement interpretation.

Each populated representation has its own copy action, and the copy shortcut collects all four labeled values. Quick presets cover common decimal values from 0 through 65535, while the reference table shows binary, octal, decimal, and hexadecimal forms for frequently used boundaries.

How to use

  1. Choose the source base

    Click the binary, octal, decimal, or hexadecimal field that matches the notation you already have.

  2. Enter a valid integer

    Use only digits legal in that base: 0–1 for binary, 0–7 for octal, 0–9 for decimal, and 0–9 plus A–F for hexadecimal. Common base prefixes are accepted and removed before parsing.

  3. Read the synchronized values

    As you type, the other three fields update with equivalent integer representations. You can also load one of the decimal quick values.

  4. Copy or clear

    Copy an individual field, use the copy shortcut to collect all four labeled forms, or click Clear All to reset every field.

Use cases

Reading bit masks and register values

Translate a hexadecimal register value into binary to inspect individual bits, then view the same quantity in decimal for logs or documentation.

Working with file modes

Convert octal values used for Unix permissions into binary groups or decimal values when comparing representations.

Debugging protocol and color constants

Move between decimal API values and hexadecimal constants commonly shown in packet formats, memory dumps, and packed color channels.

Learning positional notation

Use synchronized fields and presets to see how powers of 2, 8, 10, and 16 represent the same integer.

Common mistakes

Mistake:Assuming a leading zero makes a value octal everywhere in JavaScript.

Fix:Legacy leading-zero behavior is context-dependent and confusing. Select the Octal field or use an explicit 0o prefix in code; do not rely on a bare value such as `010` to communicate its base.

Mistake:Reading a negative binary or hexadecimal value as two's complement without specifying a width.

Fix:Two's complement requires a fixed width such as 8, 16, or 32 bits. This converter shows signed integer notation, not a padded machine representation, so decide the width before interpreting a high bit as a sign bit.

Mistake:Treating a hexadecimal value containing A–F as decimal input.

Fix:Enter it in the Hexadecimal field. Decimal accepts only 0–9, while hexadecimal assigns A–F the values 10–15.

Mistake:Using a digit that is outside the selected base.

Fix:Binary permits only 0 and 1, and octal only 0 through 7. Validate the entire input before relying on a conversion because integer parsers can stop at the first invalid digit rather than diagnose the whole string.

Frequently asked questions

References & standards