Base64 Encoder

Encode plain UTF-8 text strings into standard or URL-safe Base64 format instantly.

How to Encode Text to Base64

1

Paste Plain Text

Enter your UTF-8 plain text string into the input editor or click Sample.

2

Choose Format Options

Optionally check URL-Safe Mode for web query parameters and URL paths.

3

Live Encode & Copy

Encodes instantly in real time. Copy or download your generated Base64 output with one click.

Tool Options

URL-Safe Base64 Encoding

Replaces standard alphabet markers (+ and /) with web-friendly characters (- and _) for query strings.

Strict UTF-8 Encoding Safeguard

Correctly serializes multi-byte characters and emoji symbols into UTF-8 byte arrays before Base64 conversion.

Real-Time Character Counter

Calculates and renders target string statistics, output lengths, and padding indicators in real time.

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 Encoder do?

The Base64 Encoder converts plain UTF-8 text strings and binary bytes into ASCII string representations using a standard 64-character alphabet (A-Z, a-z, 0-9, +, /). It also supports RFC 4648 URL-safe Base64 encoding (replacing + with - and / with _ while stripping trailing = padding) for query parameters and URL paths.

Core Concepts

Understanding Base64 encoding specifications:

  • Radix-64 Encoding Scheme: Maps every 6 bits of binary data to one printable ASCII character, increasing total payload size by approximately 33%.
  • URL-Safe Base64 (RFC 4648): Swaps + and / characters for - and _, eliminating the need for URL percent-encoding in HTTP headers, cookies, and tokens.
  • Padding Syntax: Appends = characters at the end of output strings to ensure total character count is a multiple of 4.

How to use the tool?

  1. Enter Plain Text: Paste your UTF-8 text into the input editor or click Sample.
  2. Select Encoding Mode: Optionally check URL-Safe Mode for web query parameters and URL paths.
  3. Live Encode & Copy: Encodes instantly in real time. Click Copy to copy the encoded string to your clipboard.

Related Developer Utilities

If you work with Base64 encoding, cryptographic tokens, and URL data, explore these complementary tools:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/base64/encoder) to programmatically encode UTF-8 plain text into standard or URL-safe Base64 strings.

API Request Parameters

Name Type Description Example
rawText String / Object Plain UTF-8 text string or JS object to encode (aliases: text, payload, data, input, value). "Hello Blueutils!"
isUrlSafe Boolean Optional flag for URL-safe encoding (- and _, alias: urlSafe). Default: false. false

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/base64/encoder \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "Hello Blueutils!",
    "isUrlSafe": false
  }'

Python

import requests

url = "https://blueutils.com/api/base64/encoder"
payload = {
    "rawText": "Hello Blueutils!",
    "isUrlSafe": 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": "Hello Blueutils!",
                "isUrlSafe": false
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/base64/encoder"))
            .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 Returns true if text was successfully encoded. true
result String Encoded Base64 output string. "SGVsbG8gQmx1ZXV0aWxzIQ=="
isUrlSafe Boolean Confirms whether output uses URL-safe encoding. false
originalSize Number Byte size of the original input string. 16
encodedSize Number Byte size of the generated Base64 output string. 24

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "result": "SGVsbG8gQmx1ZXV0aWxzIQ==",
  "isUrlSafe": false,
  "originalSize": 16,
  "encodedSize": 24
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid input: Input text payload cannot be empty."
}

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 encode Base64?

Integrating the Base64 Encoder API into automated ingestion scripts, API proxies, or AI agent tool calling provides key benefits:

  • Rapid Script Validation: Embeds binary assets, basic authentication tokens, and webhook payloads into text-only transport layers.
  • Optimized Token Efficiency for AI Agents: LLMs struggle with manual Base64 bitwise calculation and frequently corrupt padding. Invoking the API encodes strings accurately without hallucination.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% strict UTF-8 buffer encoding and RFC 4648 URL-safe substitution.

Native Usage

How to encode Base64 locally in terminal environments or scripts:

Windows (CMD / PowerShell)

# Encode Base64 in PowerShell
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Hello Blueutils"))

Linux / Unix (Bash)

# Encode Base64 in Linux
echo -n "Hello Blueutils" | base64

Python

Using Python base64:

import base64

plain_text = "Hello Blueutils"
encoded = base64.b64encode(plain_text.encode("utf-8")).decode("utf-8")
print(encoded)

Java

Using Java standard Base64:

import java.util.Base64;
import java.nio.charset.StandardCharsets;

public class Base64Example {
    public static void main(String[] args) {
        String original = "Hello Blueutils";
        String encoded = Base64.getEncoder().encodeToString(original.getBytes(StandardCharsets.UTF_8));
        System.out.println(encoded);
    }
}

Frequently Asked Questions (FAQ)

How do I encode plain text or JSON strings into Base64?

Paste your UTF-8 plain text or JSON string into the input editor, optionally toggle URL-Safe Base64 Mode, and click Encode to Base64. The tool converts your text into standard Base64 with live byte counts instantly.

What is the difference between standard Base64 and URL-safe Base64?

Standard Base64 (RFC 4648 §4) uses + and / characters and appends = padding. URL-Safe Base64 (RFC 4648 §5) replaces + with - and / with _ while stripping = padding, making the string safe for URL paths, query parameters, and JWT tokens.

Why does Base64 encoding increase the data size by ~33%?

Base64 represents 3 binary bytes (24 bits) using 4 ASCII characters (6 bits each). Because 4 characters are required to represent 3 bytes of raw data, the resulting string is approximately 33.3% larger than the original input.

How does the encoder handle UTF-8 multibyte characters and emojis?

The encoder serializes strings directly into UTF-8 byte buffers prior to Radix-64 encoding, preserving multibyte characters, foreign language alphabets (such as Chinese, Cyrillic, or Arabic), and emoji symbols without character corruption.

Is my text or confidential data uploaded to any remote server?

No. All UTF-8 string conversions, byte buffer calculations, and Base64 translations execute 100% in-browser client-side. Your payloads and credentials never leave your device.

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.