Base64URL to Base64 Converter

Convert URL-safe Base64URL strings into standard RFC 4648 Base64 strings with automatic padding calculation.

How to Convert Base64URL to Standard Base64

1

Paste Base64URL String

Paste your URL-safe Base64URL string (from JWTs, OAuth tokens, or web crypto payloads) into the editor.

2

Live Auto-Map & Padding

The tool automatically maps - to + and _ to /, and computes required trailing = padding in real time.

3

Copy Standard Base64

Copy the standard Base64 string directly to your clipboard or download it as a text file for legacy decoders.

Tool Options

Safe Character Replacement

Translates URL-safe characters into RFC 4648 standard characters without corrupting underlying binary structures.

Smart Modulo-4 Auto-Padding

Automatically calculates and appends required trailing = or == padding characters for strict decoders.

Malformed Input Validation

Detects standard + or / characters in input and flags length anomalies to prevent downstream decoding failures.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the Base64URL to Base64 Converter do?

The Base64URL to Base64 Converter transforms URL-safe Base64URL strings (RFC 7515, commonly used in JWTs, OAuth tokens, and WebAuthn credentials) into standard RFC 4648 Base64 strings. It replaces - with +, _ with /, and computes and appends the exact trailing = padding needed for strict backend decoders.

Core Concepts

Understanding Base64URL to Base64 conversion mechanics:

  • Alphabet Character Swapping: Maps URL-safe characters (- and _) back to standard Base64 characters (+ and /).
  • Modulo-4 Padding Calculation: Base64 strings must have a length divisible by 4. If length modulo 4 is 2, two = signs are appended; if 3, one = sign is appended.
  • Input Validation: Strict error detection flags input strings containing invalid characters (such as standard + or / characters in Base64URL input) or malformed lengths (length % 4 == 1).

How to use the tool?

  1. Paste Base64URL String: Enter or paste your Base64URL string into the editor or click Sample.
  2. Live Auto-Map & Padding: The tool automatically maps characters and computes trailing = padding in real time.
  3. Copy Output: Click Copy or Download to export the standard Base64 result.

Related Developer Utilities

If you work with Base64 encoding, JWT tokens, and URL safety, explore these complementary tools:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/base64/base64url-to-base64) to programmatically convert URL-safe Base64URL strings into standard Base64 strings with exact padding calculations.

API Request Parameters

Name Type Description Example
rawText String / Object Base64URL string or object to convert (aliases: text, payload, data, input, value). "eyJzdWIiOiIxMjM0In0-w_1"

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/base64/base64url-to-base64 \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "eyJzdWIiOiIxMjM0In0-w_1"
  }'

Python

import requests

url = "https://blueutils.com/api/base64/base64url-to-base64"
payload = {"rawText": "eyJzdWIiOiIxMjM0In0-w_1"}
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": "eyJzdWIiOiIxMjM0In0-w_1"
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/base64/base64url-to-base64"))
            .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 conversion succeeded. true
converted String Converted standard Base64 string. "eyJzdWIiOiIxMjM0In0+w/1=="
inputLength Number Character length of input string. 24
outputLength Number Character length of output string. 28
paddingAdded Number Count of = characters appended. 2

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "inputLength": 24,
  "outputLength": 28,
  "paddingAdded": 2,
  "converted": "eyJzdWIiOiIxMjM0In0+w/1=="
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid Base64URL: String contains standard Base64 characters (\"+\" or \"/\")."
}

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 Base64URL to Base64?

Integrating the Base64URL to Base64 API into authentication microservices, token validation layers, or AI agent tool calling provides key benefits:

  • Rapid Script Validation: Converts unpadded URL-safe tokens from OAuth identity providers into standard Base64 payloads compatible with strict legacy crypto libraries.
  • Optimized Token Efficiency for AI Agents: LLMs frequently miscount modulo-4 padding characters. Invoking the API normalizes strings deterministically without hallucination.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% accurate character swapping and RFC 4648 padding syntax.

Native Usage

How to convert Base64URL to standard Base64 locally in terminal environments or scripts:

Windows (CMD / PowerShell)

# Convert Base64URL to standard Base64 in PowerShell
$b64url = "eyJzdWIiOiIxMjM0In0-w_1"
$b64 = $b64url.Replace('-', '+').Replace('_', '/')
$pad = (4 - ($b64.Length % 4)) % 4
$b64 = $b64 + ('=' * $pad)
Write-Output "Standard Base64: $b64"

Linux / Unix (Bash)

# Convert Base64URL to standard Base64 in Linux
b64url="eyJzdWIiOiIxMjM0In0-w_1"
b64=$(echo -n "$b64url" | tr '_-' '/+')
pad=$(( (4 - ${#b64} % 4) % 4 ))
printf '%s%*s\n' "$b64" $pad '' | tr ' ' '='

Python

Using Python:

def base64url_to_base64(b64url_str):
    b64 = b64url_str.replace('-', '+').replace('_', '/')
    pad = (4 - len(b64) % 4) % 4
    return b64 + ('=' * pad)

token = "eyJzdWIiOiIxMjM0In0-w_1"
print("Standard Base64:", base64url_to_base64(token))

Java

Using Java:

public class Base64UrlToBase64Example {
    public static String toBase64(String base64Url) {
        String base64 = base64Url.replace('-', '+').replace('_', '/');
        int remainder = base64.length() % 4;
        if (remainder == 2) base64 += "==";
        else if (remainder == 3) base64 += "=";
        return base64;
    }

    public static void main(String[] args) {
        String urlSafe = "eyJzdWIiOiIxMjM0In0-w_1";
        System.out.println(toBase64(urlSafe));
    }
}

Frequently Asked Questions (FAQ)

How do I convert Base64URL to standard Base64?

Paste your Base64URL string into the editor and click Convert to Standard Base64. The tool converts '-' to '+', '_' to '/', and appends required '=' padding.

Why do standard Base64 decoders fail on Base64URL strings?

Strict standard Base64 decoders expect length to be a multiple of 4 padded with '=' and reject '-' or '_' characters.

Is data processed locally?

Yes. All character mapping and padding calculations run 100% client-side in your browser.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.