What does the Base64 to Hex Converter do?
The Base64 to Hex Converter decodes standard Base64, URL-safe Base64 (base64url), and MIME Data URIs into formatted hexadecimal byte streams. It allows network engineers, security analysts, and backend developers to inspect binary memory layouts, analyze cryptographic key material, format byte payloads for C/Rust structs, and parse network packets without running manual shell scripts.
Core Concepts
- Binary-to-Text Transcoding: Standard Base64 (RFC 4648 §4) represents every 3 raw bytes (24 bits) as 4 ASCII characters (6 bits each). Hexadecimal (Base16, RFC 4648 §8) encodes each byte (8 bits) as 2 hexadecimal characters (
00toFF). - URL-Safe Normalization: Standard Base64 uses
+and/characters with=padding. URL-safe Base64 replaces them with-and_and frequently omits trailing padding. This converter normalizes URL-safe representations back to standard Base64 before byte decoding. - Data URI Stripping: Data URIs (e.g.
data:image/png;base64,iVBORw...) include metadata headers. The parser automatically extracts the raw Base64 payload prior to hexadecimal conversion.
How to use the tool?
- Paste Base64 String: Input your Base64 payload, JWT signature segment, cryptographic key string, or Data URI into the editor or click Sample.
- Configure Delimiter & Formatting: Select between Space (
48 65 6c), None (48656c), Colon (48:65:6c), Dash (48-65-6c), or Comma (48, 65, 6c), optional prefix (0x,\x), and lowercase/uppercase casing. - Live Conversion & Export: The tool converts instantly in real time. Click Copy or Download to export the hexadecimal output.
Related Developer Utilities
- Base64 Encoder: Encode raw UTF-8 text strings to standard and URL-safe Base64.
- Base64 Decoder: Decode Base64 payloads back to UTF-8 text or formatted JSON.
- Base64 to Base64URL: Convert standard RFC 4648 Base64 strings to URL-safe Base64 format.
- Base64URL to Base64: Restore padding and standard Base64 characters from URL-safe strings.
REST API Integration
blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/base64/base64-to-hex) for programmatic integration into CI/CD pipelines, build systems, and autonomous agent workflows.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
rawText |
String / Object | Raw Base64 string, URL-safe Base64, or Data URI (aliases: text, payload, data, input, value). |
"SGVsbG8=" |
delimiter |
String | Optional separator between hex bytes ("", " ", ":", "-", ", "). Default is " ". |
" " |
prefix |
String | Optional prefix for each byte ("", "0x", "\\x"). Default is "". |
"0x" |
caseFormat |
String | Casing for hex characters ("lower" or "upper"). Default is "lower". |
"upper" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/base64/base64-to-hex \
-H "Content-Type: application/json" \
-d '{ "rawText": "SGVsbG8gQmx1ZXV0aWxzIQ==", "delimiter": " ", "caseFormat": "upper" }'Python
import requests
url = "https://blueutils.com/api/base64/base64-to-hex"
payload = {
"rawText": "SGVsbG8gQmx1ZXV0aWxzIQ==",
"delimiter": " ",
"caseFormat": "upper"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = "{\"rawText\": \"SGVsbG8gQmx1ZXV0aWxzIQ==\", \"delimiter\": \" \", \"caseFormat\": \"upper\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/base64/base64-to-hex"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether Base64 parsing and hex conversion succeeded. | true |
result |
String | Formatted hexadecimal output string. | "48 65 6C 6C 6F" |
rawHex |
String | Continuous unformatted hexadecimal string. | "48656c6c6f" |
byteLength |
Number | Total decoded binary payload length in bytes. | 5 |
bitLength |
Number | Total decoded binary length in bits. | 40 |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"result": "48 65 6C 6C 6F 20 42 6C 75 65 75 74 69 6C 73 21",
"rawHex": "48656C6C6F20426C75657574696C7321",
"byteLength": 16,
"bitLength": 128,
"delimiter": " ",
"prefix": "",
"caseFormat": "upper"
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Invalid Base64 format: String contains non-Base64 characters or invalid padding length."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to convert Base64 to Hex?
Integrating the Base64 to Hex API into automated build pipelines and microservice architectures provides distinct advantages:
- Automated Binary Asset Verification: Verify binary file signatures, firmware payloads, and compiled artifacts directly within CI/CD release verification jobs.
- Optimized Token Efficiency for AI Agents: AI coding agents frequently struggle with raw binary bit shifts and hex decoding. Offloading Base64-to-Hex conversions saves hundreds of prompt tokens per interaction.
- Deterministic Accuracy Without Hallucinations: Cryptographic keys, authorization tokens, and hashes require byte-for-byte exactness. Blueutils executes native buffer transformations to guarantee 100% precision.
Native Usage
Perform Base64 to Hexadecimal conversions locally without external dependencies using native OS tools:
Windows (PowerShell)
# Convert Base64 string to Hex in PowerShell
$b64 = "SGVsbG8="
$bytes = [System.Convert]::FromBase64String($b64)
$hex = [System.BitConverter]::ToString($bytes) -replace '-'
Write-Output $hexLinux / Unix (Bash)
# Convert Base64 string to Hex using xxd or od
echo -n "SGVsbG8=" | base64 -d | xxd -pPython
import base64
b64_str = "SGVsbG8="
raw_bytes = base64.b64decode(b64_str)
hex_str = raw_bytes.hex()
print(hex_str)Java
import java.util.Base64;
import java.util.HexFormat;
public class Base64Hex {
public static void main(String[] args) {
String b64 = "SGVsbG8=";
byte[] bytes = Base64.getDecoder().decode(b64);
String hex = HexFormat.of().formatHex(bytes);
System.out.println(hex);
}
}