Hexadecimal Converter

Enter Value
Examples:
2Binary
11111111.01010111111010110100
8Octal
377.25765515602517626145
10Decimal
255.3434342
16Hexadecimal
ff.57eb4dc153f2c65b9983

Free online number base converter. Instantly convert between hexadecimal, decimal, binary, octal and all bases from 2 to 36. Supports fractional numbers with high-precision Decimal.js arithmetic. No sign-up, runs entirely in your browser.

Related

What is a Hexadecimal Converter?

A hexadecimal converter is a tool that transforms numbers between different positional numeral systems (bases/radices). The most common conversions are between hexadecimal (base-16), decimal (base-10), binary (base-2), and octal (base-8). Each number system represents the same numeric value using a different set of digits.

Hexadecimal uses 16 symbols: 0-9 for values 0 to 9, and A-F (or a-f) for values 10 to 15. It is widely used in computing because one hex digit corresponds exactly to 4 binary digits (a nibble), making it a compact way to represent binary data. Two hex digits represent one byte (00 to FF = 0 to 255).

Binary (base-2) uses only 0 and 1 and is the fundamental language of computers. Octal (base-8) uses digits 0-7 and was historically used in computing. Decimal (base-10) is the standard human number system using digits 0-9.

This converter supports all bases from 2 to 36. Bases above 10 use letters a-z for digits beyond 9 (e.g., base-36 uses 0-9 and a-z). It also supports negative numbers and fractional values with high-precision arithmetic.

Use Cases

  • Convert hex color codes like #FF5733 to RGB decimal values for web development
  • Convert memory addresses and hex dumps to readable decimal values while debugging
  • Translate binary network packet data to hex or decimal for protocol analysis
  • Learn and practice number system conversions for computer science courses
  • Convert hexadecimal values from programming logs into decimal or binary
  • Quickly convert between octal Unix file permissions and decimal chmod values

How to Use

  1. Enter a number in the input box at the top of the tool
  2. Select the base (radix) of your input number using the dropdown — choose from binary (2) up to base-36
  3. View instant conversion results for binary, octal, decimal, hexadecimal and more
  4. Click any result card to switch the input to that base and continue converting
  5. Click the copy icon on any result card to copy the converted value to clipboard
  6. Expand 'Other Radices (2-36)' to see results for all bases from 2 to 36

Features

  • Supports all number bases from 2 to 36: binary (2), octal (8), decimal (10), hexadecimal (16) and more
  • High-precision conversion powered by Decimal.js — handles integers and fractional numbers accurately
  • Instant real-time results as you type — no button clicks needed
  • One-click copy for each conversion result
  • Supports negative numbers and decimal fractions (up to 20 fractional digits)
  • Runs 100% in your browser — no data uploaded, no registration required

Number Encoding Comparison: Which Should You Use?

Binary, octal, decimal, hexadecimal, and Base64 each have their own use cases. Choosing the wrong one doubles the size, makes it error-prone, or causes URL compatibility issues. First consider 'who sees the output, where it lives, and how compact it needs to be', then pick a specific encoding.

Binary vs Octal vs Decimal vs Hexadecimal: Typical Use Cases

All 4 common number bases have a place in engineering. Deciding by 'typical use / density / human readability / caveats' is far more reliable than deciding by the numbers themselves.

BaseTypical useDensityHuman readabilityCaveat
Binary (base-2)Low-level hardware, bitmasks, boolean protocols, protocol fieldsVery low (1 bit / char)Very poor (hard for the eye)Almost never shown to users directly; usually replaced by hex at the lower layer
Octal (base-8)Unix file permissions (chmod 755), historical PDP-11 assemblyLow (3 bits / char)Medium (short numbers readable, longer ones still long)Rarely used in modern apps; Python 2's `0o755` still works in Python 3 but is no longer mainstream
Decimal (base-10)User I/O, business logic, configuration parametersMedium (~3.32 bits / char)Best (natural for humans)Less compact than hex; conversion is required when debugging binary data
Hexadecimal (base-16)Color codes, memory addresses, byte streams, MAC/UUID, bytecodeHigh (4 bits / char, 1 byte = 2 chars)Good (compact + aligned to byte boundaries)Be consistent about case (A-F vs a-f) and watch out for `0x` prefix ambiguity

Hexadecimal vs Base64 Encoding: Which to Use?

Hex and Base64 are both text representations of bytes, but they suit very different use cases. Decide by 'target medium / density / human readability / URL compatibility' to avoid costly rework.

DimensionHexadecimalBase64
Character set0-9 + A-F (16 symbols)A-Z + a-z + 0-9 + + / (64 symbols)
Chars per byte2 chars / byte~1.33 chars / byte
DensityMedium (1 byte -> 2 chars)High (3 bytes -> 4 chars)
URL-safe✓ Fully URL-safe✗ Standard Base64 contains + and /; use the URL-safe Base64 variant
Human readabilityGood (debugging, binary-dump friendly)Poor (random characters, hard to spot boundaries)
Best forColor codes, memory addresses, MAC, UUID, debug logs, binary file previewsData URIs, email attachments (MIME), API tokens, JWT, embedding images in CSS/HTML
Not great forLong URL parameters (use base64url instead), data URIs (doubles the size)Debug logs (hard to see field boundaries), color codes (not directly usable in CSS)

Best Practices

Keep hexadecimal letter case consistent (A-F vs a-f)

Within a single project, hex letters should be either all uppercase or all lowercase — **never mix the two**. C/C++/Go/HTML color codes traditionally use uppercase A-F; JSON, URLs, UUID (RFC 4122), Ethereum addresses, and JavaScript strings tend to use lowercase a-f. Mixed case does not change the value, but cross-language parsing (e.g. `int('FF', 16)` vs `int('ff', 16)`) and human reading both suffer — `FF5733` and `ff5733` look almost identical in logs, leading to easy misreads during debugging.

What is hexadecimal?

Always mark the `0x` prefix or document the value as unsigned decimal

Numbers in JSON, URL parameters, and API fields default to decimal. The string `100` in JSON is decimal 100, but `0x100` is hexadecimal 256. **You must** explicitly mark the `0x` prefix (or add a `hex` suffix to the field name); otherwise the backend reads it as decimal and gets the wrong value (100 vs 256 — a 2.56x difference). When integrating APIs from multiple vendors, we strongly recommend fixing this in the protocol doc: every hex field must carry the `0x` prefix.

Why are letters used in hexadecimal and higher bases?

Always specify endianness (Big/Little) explicitly during conversion

Network protocols, file formats, and hardware registers almost always enforce an endianness — network byte order is big-endian, while x86/ARM CPUs default to little-endian. **Always specify the byte order explicitly on read and write**, otherwise the same hex value `0x1234` is interpreted as `0x1234` or `0x3412` depending on endianness — a 4x difference. Use Python's `int.from_bytes(b, 'big')` / `'little'`, Go's `binary.BigEndian` / `binary.LittleEndian`, or C's `htonl` / `htons` / `ntohl` / `ntohs`. Never guess.

How do I convert decimal to hexadecimal?

Use lowercase for MAC addresses, UUIDs, and hash values

RFC 4122 explicitly requires UUIDs to be lowercase; IEEE 802 MAC address convention is lowercase; Ethereum addresses, git commit hashes, TLS fingerprints, and file SHA-256 hashes are almost always lowercase by default. **Use lowercase consistently when emitting hex identifiers in bulk** — this avoids copy-paste differences between Linux/Mac/Windows (Windows clipboard occasionally changes case). Log systems, CMS, and config centers all deduplicate and index by lowercase; mixed case is treated as two different entries.

RFC 4122 - UUID Standard

Watch for the alpha channel when converting color codes

The CSS color code `#FF5733` is 6-digit RGB; `#FF573380` is 8-digit RGBA (the last two digits `80` = 50% alpha); the short form `#F53` is equivalent to `#FF5533`. This tool only processes the numeric part, so **the alpha channel needs separate handling**. When applying design-spec colors in bulk to code, group them by length first (6-digit vs 8-digit). Do not mistake 8-digit RGBA for 6-digit RGB — you will drop alpha and turn a transparent color into a solid one.

RGB/HEX Color Converter

Do not lose separators when converting IPv6 and MAC addresses

An IPv6 address is 32 hex digits + 7 colon-separated groups (e.g. `2001:0db8:85a3:0000:0000:8a2e:0370:7334`); a MAC address is 12 hex digits + 5 colons or hyphens (e.g. `00:1A:2B:3C:4D:5E`). **When using this tool to convert raw hex strings**: a full IPv6 like `20010db8...` becomes a huge number in decimal (a complete IPv6 is around 3.4x10^38), and on the way back you must re-group by 4/2 digits and add the colons. For bulk IPv6/MAC processing, prefer a dedicated tool (the network tools next to `/other/color-convert/`) instead of using this tool for end-to-end conversion.

Which number systems does this converter support?

Never treat hex strings as passwords or sensitive credentials

A '32-digit hex string' looks like a strong password (e.g. `a3f8b9c2d1e0f7a6b5c4d3e2f1a0b9c8`) — its entropy is only 16 bytes = 128 bits, which sounds fine, but **the hex representation is often the secret/token itself** — API keys, JWT secrets, symmetric encryption keys, TOTP secrets, crypto-wallet private keys, and HMAC keys are all hex strings. Once leaked, you are fully exposed. **Never** paste them into tickets, Slack, emails, or screenshots, and never use any online tool (even one that claims to process locally) to convert them. This tool is a format converter, not suitable for any hex string that carries key-like semantics.

Is my data safe? Does it get sent to a server?

FAQ

What number systems (bases) does this converter support?

This converter supports all integer bases from 2 (binary) to 36. The most commonly used are binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16), which are displayed as quick-access cards. Expand 'Other Radices' to see results for all bases.

How do I convert hexadecimal to decimal?

Select hexadecimal (base-16) as the input radix using the dropdown, then type or paste your hex value (e.g., FF, A3, 1A2B). The decimal result will appear instantly in the decimal result card. For example, hex FF converts to decimal 255.

How do I convert decimal to hexadecimal?

Make sure decimal (base-10) is selected as the input radix, then enter your decimal number (e.g., 255, 1024, 65535). The hexadecimal result appears instantly in the hex result card. For example, decimal 255 converts to hex FF.

How do I convert binary to hexadecimal?

Select binary (base-2) as the input radix, enter your binary string (e.g., 11111111), and the hexadecimal result will show immediately. Every 4 binary digits map to 1 hex digit, so 11111111 (8 bits) = FF in hex.

Does it support fractional numbers (decimals)?

Yes. The converter supports fractional numbers like 3.14 or FF.8. Fractional parts are calculated with up to 20 digits of precision using Decimal.js high-precision arithmetic to avoid floating-point errors common in standard JavaScript math.

Does it support negative numbers?

Yes. Simply prepend a minus sign (-) to your input number, e.g., -255 or -FF. The converter will handle negative values correctly across all bases.

What is the difference between hexadecimal and Base64 encoding?

Hexadecimal uses 16 symbols (0-9, A-F) and produces 2 characters per byte. Base64 uses 64 symbols (A-Z, a-z, 0-9, +, /) and produces roughly 4 characters per 3 bytes, making it more compact. Hex is common for debugging, color codes, and memory addresses; Base64 is common for data URIs, email attachments, and API payloads. If you need Base64 conversion, try our HEX to Base64 tool.

Why is hexadecimal used in programming?

Hexadecimal is used because it provides a human-readable representation of binary data. One hex digit = 4 bits, two hex digits = 1 byte. This makes it easy to read memory addresses, color codes (#FF5733), MAC addresses, character encodings, and binary file contents without dealing with long strings of 0s and 1s.

Is my data safe? Does it get sent to a server?

No. All conversions run entirely in your browser using JavaScript. The numbers you enter never leave your device. There is no server processing, no data storage, and no tracking of your input. The tool works offline once the page has loaded.

What does 'base' or 'radix' mean?

The base (or radix) of a number system is the number of unique digits used to represent numbers. Base-2 (binary) uses 2 digits (0,1); base-10 (decimal) uses 10 digits (0-9); base-16 (hexadecimal) uses 16 symbols (0-9, A-F). The same numeric value looks different in different bases — e.g., decimal 255 is FF in hex and 11111111 in binary.

Why are letters used in hexadecimal and higher bases?

When the base exceeds 10, we need more than 10 symbols (0-9). Letters a-z (or A-Z) are used as additional digits. In hexadecimal, A=10, B=11, C=12, D=13, E=14, F=15. In base-36, we use all digits 0-9 plus all letters a-z to represent values 0-35.

Can I convert large numbers without losing precision?

Yes. This converter uses Decimal.js for arbitrary-precision decimal arithmetic, avoiding the floating-point precision issues that standard JavaScript Number type has with very large integers. Extremely large numbers (beyond what Decimal.js can represent) may show as Infinity, but all practical programming and learning use cases are fully supported.

Privacy & Security

All number conversions run 100% in your browser. The numbers you enter are processed locally using JavaScript and never transmitted to any server. No data is stored, logged, or analyzed. The tool works offline once loaded.