Skip to main content
Cookie preferences

We use analytics cookies to understand usage and improve CleanTextLab. You can accept or decline Privacy policy. Manage preferences.

Back to Blog

Hex Converter Online: Text, Numbers, and Color Codes

7 min read

Hex Converter Online: Text, Numbers, and Color Codes

You have a string like 48 65 6c 6c 6f and need to know what it says. Or you're writing firmware and need "Hello" as its raw byte values. Or a designer sends you rgb(30, 144, 255) and you need the hex code for your CSS.

Three different problems. One answer: hexadecimal conversion.


Quick Solution: Convert Hex Online

The fastest way:

  1. Go to CleanTextLab's Hex Converter
  2. Choose Text, Number, or Color mode
  3. Paste your input
  4. Copy the result

No signup. No ads. Runs in your browser.


Mode 1: Text ↔ Hex

The most common use case — converting readable text to hex bytes and back.

Text → Hex

Input: Hello Output: 48 65 6c 6c 6f

Each character becomes its UTF-8 byte value in hexadecimal:

CharacterDecimalHex
H7248
e10165
l1086c
l1086c
o1116f

Hex → Text

Paste 48 65 6c 6c 6f — the tool strips spaces, colons, and 0x prefixes automatically — and get Hello back.

Multi-byte UTF-8 is handled correctly, so emoji and international text round-trip without loss:

TextHexBytes
A411 byte
éc3 a92 bytes
😀f0 9f 98 804 bytes

Output Options

  • Delimiter: Space (48 65), colon (48:65), or none (4865)
  • 0x prefix: 0x48 0x65
  • Uppercase: 48 65 6C 6C 6F

Mode 2: Number Base Conversion

Convert between decimal, hexadecimal, binary, and octal — with full BigInt support for numbers beyond JavaScript's Number.MAX_SAFE_INTEGER (2⁵³).

Example: 255

BaseValue
Decimal255
Hexff
Binary11111111
Octal377

Example: Beyond MAX_SAFE_INTEGER

Input:   9007199254740993
Dec:     9007199254740993
Hex:     20000000000001
Bin:     100000000000000000000000000000000000000000000000001
Oct:     400000000000000001

Standard JavaScript Number loses precision here. The tool uses native BigInt and stays exact.

Accepted Input Formats

FormatExample
Decimal255
Hex prefix0xff
Binary prefix0b11111111
Negative-255

Mode 3: Color Code Conversion

Convert between hex color codes, RGB, and HSL — essential for CSS and design work.

Example: Dodger Blue

Input: #1e90ff

FormatValue
Hex#1e90ff
RGBrgb(30, 144, 255)
HSLhsl(210, 100%, 56%)

Accepted Color Input

  • Hex codes: #1e90ff, #1E90FF, #fff (3-digit shorthand)
  • RGB: rgb(30, 144, 255) or rgba(30, 144, 255, 0.8)
  • CSS named colors: dodgerblue, coral, tomato, rebeccapurple

The tool also includes a native color picker — click the color swatch to open your browser's built-in picker and sync the hex value automatically.

Using in CSS

/* All three are equivalent */
color: #1e90ff;
color: rgb(30, 144, 255);
color: hsl(210, 100%, 56%);

Converting Hex in Code

JavaScript: Text to Hex

function textToHex(text, separator = ' ') {
  return Array.from(new TextEncoder().encode(text))
    .map(b => b.toString(16).padStart(2, '0'))
    .join(separator);
}

textToHex('Hello');       // '48 65 6c 6c 6f'
textToHex('Hello', ':');  // '48:65:6c:6c:6f'
textToHex('Hello', '');   // '48656c6c6f'

JavaScript: Hex to Text

function hexToText(hex) {
  const clean = hex.replace(/0x/gi, '').replace(/[^0-9a-fA-F]/g, '');
  const bytes = new Uint8Array(clean.match(/.{2}/g).map(b => parseInt(b, 16)));
  return new TextDecoder('utf-8').decode(bytes);
}

hexToText('48 65 6c 6c 6f');        // 'Hello'
hexToText('0x48:0x65:0x6c');        // 'Hel'
hexToText('f0 9f 98 80');            // '😀'

JavaScript: Number Base Conversion

// Standard integers
(255).toString(16);   // 'ff'
(255).toString(2);    // '11111111'
(255).toString(8);    // '377'

// BigInt for precision beyond 2^53
BigInt('9007199254740993').toString(16);  // '20000000000001'

// Hex string to integer
parseInt('ff', 16);   // 255
parseInt('0xff', 16); // 255

Python: Text to Hex

text = "Hello"

# No separator
print(text.encode('utf-8').hex())
# '48656c6c6f'

# With spaces
spaced = ' '.join(f'{b:02x}' for b in text.encode('utf-8'))
print(spaced)
# '48 65 6c 6c 6f'

# With 0x prefix
prefixed = ' '.join(f'0x{b:02x}' for b in text.encode('utf-8'))
print(prefixed)
# '0x48 0x65 0x6c 0x6c 0x6f'

Python: Hex to Text

hex_str = '48 65 6c 6c 6f'
clean = hex_str.replace(' ', '').replace('0x', '')
text = bytes.fromhex(clean).decode('utf-8')
print(text)  # 'Hello'

Python: Number Conversion

n = 255
print(hex(n))    # '0xff'
print(bin(n))    # '0b11111111'
print(oct(n))    # '0o377'

# Hex string to int
print(int('ff', 16))    # 255
print(int('0xff', 16))  # 255

# Python integers have unlimited precision natively
big = 9007199254740993
print(hex(big))  # '0x20000000000001'

Common Use Cases

Protocol Debugging

Network captures and serial logs often contain raw bytes like ff 03 2a 00 08 c0. Paste them into Text mode to decode the string payload instantly.

Firmware and Embedded Systems

When writing memory addresses or byte constants in C or assembly:

// These are the same
const char msg[] = "Hello";
const uint8_t msg[] = {0x48, 0x65, 0x6c, 0x6c, 0x6f};

The tool converts between them without mental arithmetic.

CSS Color Workflow

Design handoffs often mix formats — Figma exports #3b82f6, Tailwind config wants rgb(), CSS variables use hsl(). Convert once, copy any format.

Inspecting UUID Segments

UUIDs contain hex: 550e8400-e29b-41d4-a716-446655440000. Each segment is a hex value. The number mode lets you inspect or convert individual segments.

Encoding Verification

Encode text → get hex → decode the hex back. Confirm the round-trip is lossless before putting data on the wire.


Hex vs Other Encodings

EncodingUse CaseOutput for "Hi"
HexRaw bytes, protocols, colors48 69
Base64Binary in text/JSON contextSGk=
URL encodingSpecial chars in URLs%48%69
BinaryBit-level inspection01001000 01101001

Hex has a strict 1:1 relationship: two hex digits = one byte. Unlike Base64, there's no padding and no ambiguity about length.


Frequently Asked Questions

What is hexadecimal?

Hexadecimal (base-16) uses 16 symbols: digits 0–9 and letters A–F. One hex digit represents 4 bits; two hex digits represent one byte (values 0–255). Computers use it because it compresses binary into a compact, readable form — ff is much easier to read than 11111111.

How many hex digits is a byte?

Always two. A byte is 8 bits = 2 hex digits. That's why hex strings come in pairs: ff, 0a, 3e. A string with an odd number of digits is malformed.

What does the 0x prefix mean?

0x is a C-style notation indicating a hexadecimal literal. 0xff = 255 decimal. The tool accepts and strips this prefix automatically regardless of input format.

Does it handle Unicode and emoji?

Yes. All text conversion uses UTF-8, which covers the full Unicode range. 😀 encodes to f0 9f 98 80 (4 bytes) and decodes back exactly. Non-UTF-8 byte sequences fall back to Latin-1 rather than erroring.

Is my data sent to a server?

No. All conversions run in JavaScript in your browser. Nothing is uploaded or stored anywhere.

Does it support numbers larger than 2⁵³?

Yes. Number mode uses JavaScript's native BigInt type, so integers of arbitrary size are handled with exact precision. Standard Number loses accuracy above 9,007,199,254,740,992 — BigInt does not.

Can I use it in an API or automation?

Yes. CleanTextLab has an n8n community node and an MCP server that expose all tools — including the hex converter — to workflows and AI agents.


Related Tools


Conclusion

Hexadecimal appears throughout computing: color codes, byte streams, number bases, firmware, network protocols. With CleanTextLab's Hex Converter:

  • Text mode — encode UTF-8 to hex bytes and decode back, with delimiter and prefix options
  • Number mode — convert between decimal, hex, binary, and octal with BigInt precision
  • Color mode — translate hex, RGB, and HSL with a built-in color picker

No signup. No ads. Runs in your browser.

Try it now: cleantextlab.com/tools/hex-converter

Try the tools mentioned

Fast, deterministic processing as discussed in this post.

Share this post
Hex Converter Online: Text, Numbers, and Color Codes | CleanTextLab Blog