Base64 to Base64URL Converter

Convert standard RFC 4648 Base64 strings into URL-safe Base64URL strings by mapping special characters and stripping trailing padding.

How to Convert Standard Base64 to URL-Safe Base64URL

1

Paste Standard Base64

Paste your standard RFC 4648 Base64 string containing +, /, or = padding.

2

Live Auto-Map & Strip Padding

The tool converts in real time, mapping + to - and / to _, and stripping trailing = padding.

3

Use in URLs & Web APIs

Copy or download the URL-safe Base64URL string to embed directly in JWT tokens, OAuth parameters, and query strings.

Tool Options

URL & URI Safe Mapping

Replaces reserved URL characters (+-, /_) to prevent HTTP transport errors.

Padding Stripping & Options

Omits trailing = characters by default according to Base64URL conventions or preserves them on demand.

Instant Client-Side Processing

Direct character stream replacement runs 100% in your browser without transmitting sensitive tokens over the network.

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

The Base64 to Base64URL Converter transforms standard RFC 4648 Base64 strings containing +, /, and = characters into URL-safe Base64URL format (RFC 7515). It replaces + with -, / with _, and strips trailing = padding characters by default (or preserves them optionally).

Core Concepts

Understanding Base64 to Base64URL conversion mechanics:

  • Alphabet Character Replacement: Replaces URI-reserved characters + with - and / with _ to prevent percent-encoding expansion in HTTP URLs and web query strings.
  • Padding Stripping: Removes trailing = padding characters by default, following RFC 7515 specifications for JWT headers, claims, and signatures.
  • Input Validation: Detects existing Base64URL characters (- or _) in input and flags non-Base64 illegal characters.

How to use the tool?

  1. Paste Standard Base64: Enter or paste your standard Base64 string into the input editor or click Sample.
  2. Configure Padding: Optionally check Preserve '=' Padding if your downstream parser requires trailing = characters.
  3. Live Convert & Copy: The tool converts instantly in real time. Click Copy or Download to export the URL-safe result.

Related Developer Utilities

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

REST API Integration

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

API Request Parameters

Name Type Description Example
rawText String / Object Standard Base64 string or object to convert (aliases: text, payload, data, input, value). "eyJzdWIiOiIxMjM0In0+w/1=="
preservePadding Boolean Optional flag to retain = padding. Default: false. false

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/base64/base64-to-base64url \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "eyJzdWIiOiIxMjM0In0+w/1==",
    "preservePadding": false
  }'

Python

import requests

url = "https://blueutils.com/api/base64/base64-to-base64url"
payload = {
    "rawText": "eyJzdWIiOiIxMjM0In0+w/1==",
    "preservePadding": False
}
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==",
                "preservePadding": false
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/base64/base64-to-base64url"))
            .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 URL-safe Base64URL string. "eyJzdWIiOiIxMjM0In0-w_1"
inputLength Number Character length of input string. 28
outputLength Number Character length of output string. 24
paddingRemoved Number Count of = characters stripped. 2

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "inputLength": 28,
  "outputLength": 24,
  "paddingRemoved": 2,
  "converted": "eyJzdWIiOiIxMjM0In0-w_1"
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid standard Base64: String contains Base64URL 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 Base64 to Base64URL?

Integrating the Base64 to Base64URL API into OAuth services, JWT signing pipelines, or AI agent tool calling provides essential advantages:

  • Rapid Script Validation: Safely formats encrypted tokens for transmission within URL query parameters and HTTP redirection headers without percent-encoding bloat.
  • Optimized Token Efficiency for AI Agents: LLMs often retain = padding characters in URL-safe outputs. Calling the API normalizes strings deterministically without hallucination.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% strict character mapping and configurable padding retention.

Native Usage

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

Windows (CMD / PowerShell)

# Convert Base64 to Base64URL in PowerShell
$b64 = "eyJzdWIiOiIxMjM0In0+w/1=="
$b64url = $b64.Replace('+', '-').Replace('/', '_').TrimEnd('=')
Write-Output "Base64URL: $b64url"

Linux / Unix (Bash)

# Convert Base64 to Base64URL in Linux
echo -n "eyJzdWIiOiIxMjM0In0+w/1==" | tr '/+' '_-' | tr -d '='

Python

Using Python:

def base64_to_base64url(b64_str, preserve_padding=False):
    b64url = b64_str.replace('+', '-').replace('/', '_')
    return b64url if preserve_padding else b64url.rstrip('=')

token = "eyJzdWIiOiIxMjM0In0+w/1=="
print("Base64URL:", base64_to_base64url(token))

Java

Using Java:

public class Base64ToBase64UrlExample {
    public static String toBase64Url(String base64, boolean preservePadding) {
        String urlSafe = base64.replace('+', '-').replace('/', '_');
        return preservePadding ? urlSafe : urlSafe.replaceAll("=+$", "");
    }

    public static void main(String[] args) {
        String standard = "eyJzdWIiOiIxMjM0In0+w/1==";
        System.out.println(toBase64Url(standard, false));
    }
}

Frequently Asked Questions (FAQ)

How do I convert standard Base64 to Base64URL?

Paste your standard Base64 string into the input box and click Convert to Base64URL. The tool replaces '+' with '-', '/' with '_', and strips trailing '=' padding.

Why use Base64URL instead of standard Base64?

Base64URL is safe for use in URLs, query strings, and JWT tokens without requiring percent-encoding.

Can I preserve padding in Base64URL?

Yes. You can toggle the 'Preserve trailing '=' padding characters' option if your target parser requires padding.

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.