Tools

Data Converter

Convert data between HEX, ASCII, Binary, Decimal, and Base64.

What is Data Conversion?

Data conversion is the process of translating information losslessly from one encoding format to another. In payment systems and cryptography, this is a daily activity: an encryption key arrives as a Base64-encoded string from a vault, but the HSM expects HEX; a Track 2 dump from a card reader is in HEX but you need to compare it to an ASCII test fixture; an ISO 8583 message has binary fields you need to inspect in HEX. Without a fast, reliable converter, every debugging session becomes a tedious manual exercise that introduces transcription errors. This converter handles the five formats you actually encounter in payment work: HEX (the dominant format for cryptographic material, key blocks, and PIN blocks), ASCII (human-readable text for messages and labels), Binary (bit-level inspection for register flags, TVR, TSI), Decimal (counters, amounts, ATC values), and Base64 (key transport, JWT tokens, TLS certificate fragments). Every conversion preserves the underlying bytes exactly — what changes is only how they are rendered. This matters because cryptographic operations are byte-level: an XOR with the wrong encoding silently produces wrong output that may not fail loudly until much later in the transaction flow.

How to Use This Tool

  1. Enter your data in any of the five format fields: HEX, ASCII, Binary, Decimal, or Base64.
  2. The tool instantly converts your input to all the other formats — no submit button needed.
  3. Copy any output field using the inline copy button for use in your applications or HSM commands.
  4. Use it to debug protocol messages, verify encryption outputs, or prepare test fixtures.
  5. For binary input, separate bytes with spaces (01001000 01100101) for readability — the parser is whitespace-tolerant.
  6. For decimal input, each value should represent one byte (0-255), space-separated.

Common Use Cases

  • Converting encryption keys between HEX and Base64 when moving between AWS KMS, Azure Key Vault, HashiCorp Vault, and HSM-stored keys.
  • Debugging ISO 8583 payment messages by converting HEX dumps to ASCII to inspect field 48, 60, and other LLVAR text fields.
  • Preparing test vectors for EMV, ISO 9564, ANSI X9.24, and TR-31 conformance tests.
  • Verifying cryptographic outputs (CMAC, HMAC, AES ciphertext) match expected values across systems with different default encodings.
  • Inspecting Terminal Verification Results (TVR) and Transaction Status Information (TSI) bit-by-bit via the binary representation.
  • Decoding JWT (JSON Web Token) Base64URL-encoded segments to verify claims during OAuth/OIDC integration testing.
  • Reading and writing PEM-wrapped certificates and keys (PEM is Base64 with headers).
  • Cross-checking PostgreSQL bytea output (\\x prefix) against expected HEX values during database forensics.

Frequently Asked Questions

What is the difference between HEX and Base64?
HEX (hexadecimal) represents each byte as two characters from 0-9 and A-F, making the encoded string exactly 2x the size of the raw bytes. Base64 encodes 3 bytes into 4 ASCII characters using the alphabet A-Z, a-z, 0-9, +, /, producing roughly 33% size overhead. Base64 is more compact and is preferred for transport in JSON, URLs, and email; HEX is preferred for cryptographic literals because each byte boundary is visually obvious.
Why is HEX the default in payment cryptography?
HEX is unambiguous, fixed-width per byte, and trivially parseable by any language without a library. Industry standards including ISO 9564 (PIN blocks), ISO 8583 (acquirer messages), EMV Book 3 (TLV), ANSI X9.24 (DUKPT), and TR-31 (key blocks) all express keys, blocks, and binary fields in HEX. HSM command syntaxes (Thales, Futurex, Atalla) likewise expect HEX. Using anything else introduces a conversion step that adds bugs.
Can I convert binary data that includes non-printable characters?
Yes. HEX, Binary, Decimal, and Base64 can losslessly represent any byte value 0x00-0xFF. The ASCII field will show printable bytes as their characters and substitute placeholders (·) for non-printable bytes (0x00-0x1F and 0x7F-0xFF). Use HEX or Base64 if you need to round-trip arbitrary binary safely.
What is the difference between Base64 and Base64URL?
Standard Base64 uses + and / as the two non-alphanumeric characters and = for padding. Base64URL (RFC 4648 §5) substitutes - for + and _ for /, and typically omits padding, so the output is safe to use inside URLs and JWT segments without further encoding. This converter handles standard Base64; for Base64URL, replace - with + and _ with / before pasting.
How do I convert hex with a 0x prefix or with spaces?
Paste it directly — the parser strips 0x prefixes, spaces, tabs, newlines, and any non-HEX character. Inputs like "0x48 0x65 0x6C 0x6C 0x6F" and "48656C6C6F" produce identical output. Same for binary (strip non-0-1) and decimal (strip non-digits, treat whitespace as delimiters).
Is the conversion safe for sensitive data like keys and PINs?
All conversion happens entirely in your browser using client-side JavaScript. The data you paste is never sent to KeyLab servers, never logged, and never persisted across page reloads. We do not store any input data. For maximum safety with production keys, use the Desktop App which works fully offline.