URL EncodingBase64

Base64 Encoder & Decoder — Encode and decode Base64 with full Unicode support

Standard Base64 (RFC 4648). Alphabet: A-Z, a-z, 0-9, +, /. Padding with =.

Input0
Output0

Base64 Code Examples

Encode and decode Base64 across popular programming languages.

// Base64 encode a string
const encoded = btoa("Hello, World!");
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
const decoded = atob("SGVsbG8sIFdvcmxkIQ==");
// "Hello, World!"

// Encode Unicode/UTF-8 text (btoa only handles Latin1)
function encodeBase64(str) {
  const bytes = new TextEncoder().encode(str);
  const binString = Array.from(bytes, (b) => String.fromCodePoint(b)).join("");
  return btoa(binString);
}

// Decode Base64 back to Unicode/UTF-8 text
function decodeBase64(b64) {
  const binString = atob(b64);
  const bytes = Uint8Array.from(binString, (c) => c.codePointAt(0));
  return new TextDecoder().decode(bytes);
}

encodeBase64("café ☕ 日本語");
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

decodeBase64("Y2Fmw6kg4piVIOaXpeacrOiqng==");
// "café ☕ 日本語"

// Create a data URI from a string
const svg = '<svg xmlns="http://www.w3.org/2000/svg"></svg>';
const dataUri = "data:image/svg+xml;base64," + btoa(svg);

// Encode for URL-safe Base64 (replace +/ with -_)
const urlSafe = encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
// Base64 encode a string
const encoded = btoa("Hello, World!");
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
const decoded = atob("SGVsbG8sIFdvcmxkIQ==");
// "Hello, World!"

// Encode Unicode/UTF-8 text (btoa only handles Latin1)
function encodeBase64(str) {
  const bytes = new TextEncoder().encode(str);
  const binString = Array.from(bytes, (b) => String.fromCodePoint(b)).join("");
  return btoa(binString);
}

// Decode Base64 back to Unicode/UTF-8 text
function decodeBase64(b64) {
  const binString = atob(b64);
  const bytes = Uint8Array.from(binString, (c) => c.codePointAt(0));
  return new TextDecoder().decode(bytes);
}

encodeBase64("café ☕ 日本語");
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

decodeBase64("Y2Fmw6kg4piVIOaXpeacrOiqng==");
// "café ☕ 日本語"

// Create a data URI from a string
const svg = '<svg xmlns="http://www.w3.org/2000/svg"></svg>';
const dataUri = "data:image/svg+xml;base64," + btoa(svg);

// Encode for URL-safe Base64 (replace +/ with -_)
const urlSafe = encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
import base64

# Base64 encode a string
encoded = base64.b64encode(b"Hello, World!").decode("ascii")
# "SGVsbG8sIFdvcmxkIQ=="

# Base64 decode a string
decoded = base64.b64decode("SGVsbG8sIFdvcmxkIQ==").decode("utf-8")
# "Hello, World!"

# Encode Unicode/UTF-8 text
text = "café ☕ 日本語"
encoded_unicode = base64.b64encode(text.encode("utf-8")).decode("ascii")
# "Y2Fmw6kg4piVIOaXpeacrOiqng=="

# Decode back to Unicode
decoded_unicode = base64.b64decode(encoded_unicode).decode("utf-8")
# "café ☕ 日本語"

# URL-safe Base64 (uses - and _ instead of + and /)
url_safe = base64.urlsafe_b64encode(b"Hello, World!").decode("ascii")
# "SGVsbG8sIFdvcmxkIQ=="

url_decoded = base64.urlsafe_b64decode(url_safe).decode("utf-8")
# "Hello, World!"

# Encode a file to Base64
with open("image.png", "rb") as f:
    file_b64 = base64.b64encode(f.read()).decode("ascii")

# Decode Base64 back to a file
with open("output.png", "wb") as f:
    f.write(base64.b64decode(file_b64))

# Validate Base64 before decoding
try:
    base64.b64decode(user_input, validate=True)
except Exception as e:
    print(f"Invalid Base64: {e}")
import base64

# Base64 encode a string
encoded = base64.b64encode(b"Hello, World!").decode("ascii")
# "SGVsbG8sIFdvcmxkIQ=="

# Base64 decode a string
decoded = base64.b64decode("SGVsbG8sIFdvcmxkIQ==").decode("utf-8")
# "Hello, World!"

# Encode Unicode/UTF-8 text
text = "café ☕ 日本語"
encoded_unicode = base64.b64encode(text.encode("utf-8")).decode("ascii")
# "Y2Fmw6kg4piVIOaXpeacrOiqng=="

# Decode back to Unicode
decoded_unicode = base64.b64decode(encoded_unicode).decode("utf-8")
# "café ☕ 日本語"

# URL-safe Base64 (uses - and _ instead of + and /)
url_safe = base64.urlsafe_b64encode(b"Hello, World!").decode("ascii")
# "SGVsbG8sIFdvcmxkIQ=="

url_decoded = base64.urlsafe_b64decode(url_safe).decode("utf-8")
# "Hello, World!"

# Encode a file to Base64
with open("image.png", "rb") as f:
    file_b64 = base64.b64encode(f.read()).decode("ascii")

# Decode Base64 back to a file
with open("output.png", "wb") as f:
    f.write(base64.b64decode(file_b64))

# Validate Base64 before decoding
try:
    base64.b64decode(user_input, validate=True)
except Exception as e:
    print(f"Invalid Base64: {e}")
// Type-safe Base64 encoding utilities

// Encode a string to Base64 with full Unicode support
function toBase64(input: string): string {
  const bytes = new TextEncoder().encode(input);
  const binString = Array.from(bytes, (b) => String.fromCodePoint(b)).join("");
  return btoa(binString);
}

// Decode Base64 to string with full Unicode support
function fromBase64(b64: string): string {
  const binString = atob(b64);
  const bytes = Uint8Array.from(binString, (c) => c.codePointAt(0)!);
  return new TextDecoder().decode(bytes);
}

// Safe decode with error handling
function safeFromBase64(b64: string): string | null {
  try {
    return fromBase64(b64);
  } catch {
    return null; // Invalid Base64 input
  }
}

// Check if a string is valid Base64
function isBase64(str: string): boolean {
  return /^[A-Za-z0-9+/]*={0,2}$/.test(str) && str.length % 4 === 0;
}

// URL-safe Base64 encoding
function toBase64Url(input: string): string {
  return toBase64(input)
    .replace(/\+/g, "-")
    .replace(/\//g, "_")
    .replace(/=+$/, "");
}

// URL-safe Base64 decoding
function fromBase64Url(b64url: string): string {
  const b64 = b64url.replace(/-/g, "+").replace(/_/g, "/");
  const padded = b64.padEnd(b64.length + ((4 - (b64.length % 4)) % 4), "=");
  return fromBase64(padded);
}

// Usage
const encoded = toBase64("café ☕ 日本語");
const decoded = fromBase64(encoded);
// Type-safe Base64 encoding utilities

// Encode a string to Base64 with full Unicode support
function toBase64(input: string): string {
  const bytes = new TextEncoder().encode(input);
  const binString = Array.from(bytes, (b) => String.fromCodePoint(b)).join("");
  return btoa(binString);
}

// Decode Base64 to string with full Unicode support
function fromBase64(b64: string): string {
  const binString = atob(b64);
  const bytes = Uint8Array.from(binString, (c) => c.codePointAt(0)!);
  return new TextDecoder().decode(bytes);
}

// Safe decode with error handling
function safeFromBase64(b64: string): string | null {
  try {
    return fromBase64(b64);
  } catch {
    return null; // Invalid Base64 input
  }
}

// Check if a string is valid Base64
function isBase64(str: string): boolean {
  return /^[A-Za-z0-9+/]*={0,2}$/.test(str) && str.length % 4 === 0;
}

// URL-safe Base64 encoding
function toBase64Url(input: string): string {
  return toBase64(input)
    .replace(/\+/g, "-")
    .replace(/\//g, "_")
    .replace(/=+$/, "");
}

// URL-safe Base64 decoding
function fromBase64Url(b64url: string): string {
  const b64 = b64url.replace(/-/g, "+").replace(/_/g, "/");
  const padded = b64.padEnd(b64.length + ((4 - (b64.length % 4)) % 4), "=");
  return fromBase64(padded);
}

// Usage
const encoded = toBase64("café ☕ 日本語");
const decoded = fromBase64(encoded);
import java.util.Base64;
import java.nio.charset.StandardCharsets;

public class Base64Example {
    public static void main(String[] args) {
        // Base64 encode a string
        String encoded = Base64.getEncoder().encodeToString(
            "Hello, World!".getBytes(StandardCharsets.UTF_8)
        );
        // "SGVsbG8sIFdvcmxkIQ=="

        // Base64 decode a string
        String decoded = new String(
            Base64.getDecoder().decode(encoded),
            StandardCharsets.UTF_8
        );
        // "Hello, World!"

        // Encode Unicode/UTF-8 text
        String unicode = Base64.getEncoder().encodeToString(
            "café ☕ 日本語".getBytes(StandardCharsets.UTF_8)
        );
        // "Y2Fmw6kg4piVIOaXpeacrOiqng=="

        // URL-safe Base64 encoding
        String urlSafe = Base64.getUrlEncoder().encodeToString(
            "Hello, World!".getBytes(StandardCharsets.UTF_8)
        );

        // URL-safe Base64 without padding
        String noPad = Base64.getUrlEncoder().withoutPadding()
            .encodeToString("Hello, World!".getBytes(StandardCharsets.UTF_8));

        // MIME Base64 encoding (line-wrapped at 76 chars)
        String mime = Base64.getMimeEncoder().encodeToString(
            "Long content...".getBytes(StandardCharsets.UTF_8)
        );

        // Validate before decoding
        try {
            Base64.getDecoder().decode(userInput);
        } catch (IllegalArgumentException e) {
            System.out.println("Invalid Base64: " + e.getMessage());
        }
    }
}
import java.util.Base64;
import java.nio.charset.StandardCharsets;

public class Base64Example {
    public static void main(String[] args) {
        // Base64 encode a string
        String encoded = Base64.getEncoder().encodeToString(
            "Hello, World!".getBytes(StandardCharsets.UTF_8)
        );
        // "SGVsbG8sIFdvcmxkIQ=="

        // Base64 decode a string
        String decoded = new String(
            Base64.getDecoder().decode(encoded),
            StandardCharsets.UTF_8
        );
        // "Hello, World!"

        // Encode Unicode/UTF-8 text
        String unicode = Base64.getEncoder().encodeToString(
            "café ☕ 日本語".getBytes(StandardCharsets.UTF_8)
        );
        // "Y2Fmw6kg4piVIOaXpeacrOiqng=="

        // URL-safe Base64 encoding
        String urlSafe = Base64.getUrlEncoder().encodeToString(
            "Hello, World!".getBytes(StandardCharsets.UTF_8)
        );

        // URL-safe Base64 without padding
        String noPad = Base64.getUrlEncoder().withoutPadding()
            .encodeToString("Hello, World!".getBytes(StandardCharsets.UTF_8));

        // MIME Base64 encoding (line-wrapped at 76 chars)
        String mime = Base64.getMimeEncoder().encodeToString(
            "Long content...".getBytes(StandardCharsets.UTF_8)
        );

        // Validate before decoding
        try {
            Base64.getDecoder().decode(userInput);
        } catch (IllegalArgumentException e) {
            System.out.println("Invalid Base64: " + e.getMessage());
        }
    }
}
package main

import (
	"encoding/base64"
	"fmt"
)

func main() {
	// Base64 encode a string (standard encoding)
	encoded := base64.StdEncoding.EncodeToString([]byte("Hello, World!"))
	// "SGVsbG8sIFdvcmxkIQ=="

	// Base64 decode a string
	decoded, err := base64.StdEncoding.DecodeString(encoded)
	if err != nil {
		fmt.Println("Decode error:", err)
	}
	fmt.Println(string(decoded)) // "Hello, World!"

	// Encode Unicode/UTF-8 text (Go strings are UTF-8 by default)
	unicode := base64.StdEncoding.EncodeToString([]byte("café ☕ 日本語"))
	// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

	// URL-safe Base64 encoding
	urlSafe := base64.URLEncoding.EncodeToString([]byte("Hello, World!"))

	// URL-safe Base64 without padding
	noPad := base64.RawURLEncoding.EncodeToString([]byte("Hello, World!"))

	// Raw standard encoding (no padding)
	raw := base64.RawStdEncoding.EncodeToString([]byte("Hello, World!"))

	// Validate before decoding
	input := "not-valid-base64!!!"
	if _, err := base64.StdEncoding.DecodeString(input); err != nil {
		fmt.Println("Invalid Base64:", err)
	}

	fmt.Println(unicode, urlSafe, noPad, raw)
}
package main

import (
	"encoding/base64"
	"fmt"
)

func main() {
	// Base64 encode a string (standard encoding)
	encoded := base64.StdEncoding.EncodeToString([]byte("Hello, World!"))
	// "SGVsbG8sIFdvcmxkIQ=="

	// Base64 decode a string
	decoded, err := base64.StdEncoding.DecodeString(encoded)
	if err != nil {
		fmt.Println("Decode error:", err)
	}
	fmt.Println(string(decoded)) // "Hello, World!"

	// Encode Unicode/UTF-8 text (Go strings are UTF-8 by default)
	unicode := base64.StdEncoding.EncodeToString([]byte("café ☕ 日本語"))
	// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

	// URL-safe Base64 encoding
	urlSafe := base64.URLEncoding.EncodeToString([]byte("Hello, World!"))

	// URL-safe Base64 without padding
	noPad := base64.RawURLEncoding.EncodeToString([]byte("Hello, World!"))

	// Raw standard encoding (no padding)
	raw := base64.RawStdEncoding.EncodeToString([]byte("Hello, World!"))

	// Validate before decoding
	input := "not-valid-base64!!!"
	if _, err := base64.StdEncoding.DecodeString(input); err != nil {
		fmt.Println("Invalid Base64:", err)
	}

	fmt.Println(unicode, urlSafe, noPad, raw)
}
<?php
// Base64 encode a string
$encoded = base64_encode("Hello, World!");
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
$decoded = base64_decode("SGVsbG8sIFdvcmxkIQ==");
// "Hello, World!"

// Encode Unicode/UTF-8 text (PHP strings are byte sequences)
$unicode = base64_encode("café ☕ 日本語");
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

// Decode back to Unicode
$decodedUnicode = base64_decode($unicode);
// "café ☕ 日本語"

// Validate Base64 before decoding (strict mode)
$result = base64_decode($userInput, true);
if ($result === false) {
    echo "Invalid Base64 input";
}

// Create a data URI for embedding images
$imageData = file_get_contents("image.png");
$dataUri = "data:image/png;base64," . base64_encode($imageData);

// Encode for URL-safe Base64
function base64url_encode(string $data): string {
    return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}

// Decode URL-safe Base64
function base64url_decode(string $data): string {
    return base64_decode(strtr($data, '-_', '+/'));
}

// Encode/decode for API authentication headers
$credentials = base64_encode("username:password");
$header = "Authorization: Basic " . $credentials;
<?php
// Base64 encode a string
$encoded = base64_encode("Hello, World!");
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
$decoded = base64_decode("SGVsbG8sIFdvcmxkIQ==");
// "Hello, World!"

// Encode Unicode/UTF-8 text (PHP strings are byte sequences)
$unicode = base64_encode("café ☕ 日本語");
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

// Decode back to Unicode
$decodedUnicode = base64_decode($unicode);
// "café ☕ 日本語"

// Validate Base64 before decoding (strict mode)
$result = base64_decode($userInput, true);
if ($result === false) {
    echo "Invalid Base64 input";
}

// Create a data URI for embedding images
$imageData = file_get_contents("image.png");
$dataUri = "data:image/png;base64," . base64_encode($imageData);

// Encode for URL-safe Base64
function base64url_encode(string $data): string {
    return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}

// Decode URL-safe Base64
function base64url_decode(string $data): string {
    return base64_decode(strtr($data, '-_', '+/'));
}

// Encode/decode for API authentication headers
$credentials = base64_encode("username:password");
$header = "Authorization: Basic " . $credentials;
require 'base64'

# Base64 encode a string (strict, no line breaks)
encoded = Base64.strict_encode64("Hello, World!")
# "SGVsbG8sIFdvcmxkIQ=="

# Base64 decode a string
decoded = Base64.decode64("SGVsbG8sIFdvcmxkIQ==")
# "Hello, World!"

# Encode Unicode/UTF-8 text
unicode = Base64.strict_encode64("café ☕ 日本語")
# "Y2Fmw6kg4piVIOaXpeacrOiqng=="

# Decode back to Unicode
decoded_unicode = Base64.decode64(unicode).force_encoding('UTF-8')
# "café ☕ 日本語"

# Standard encode (adds line breaks every 60 chars)
long_encoded = Base64.encode64("A very long string " * 10)

# URL-safe Base64 encoding
url_safe = Base64.urlsafe_encode64("Hello, World!")

# URL-safe Base64 without padding
no_pad = Base64.urlsafe_encode64("Hello, World!", padding: false)

# URL-safe Base64 decoding
url_decoded = Base64.urlsafe_decode64(url_safe)

# Encode a file to Base64
file_b64 = Base64.strict_encode64(File.binread("image.png"))

# Decode Base64 to a file
File.binwrite("output.png", Base64.decode64(file_b64))

# Validate Base64 before decoding
begin
  Base64.strict_decode64(user_input)
rescue ArgumentError => e
  puts "Invalid Base64: #{e.message}"
end
require 'base64'

# Base64 encode a string (strict, no line breaks)
encoded = Base64.strict_encode64("Hello, World!")
# "SGVsbG8sIFdvcmxkIQ=="

# Base64 decode a string
decoded = Base64.decode64("SGVsbG8sIFdvcmxkIQ==")
# "Hello, World!"

# Encode Unicode/UTF-8 text
unicode = Base64.strict_encode64("café ☕ 日本語")
# "Y2Fmw6kg4piVIOaXpeacrOiqng=="

# Decode back to Unicode
decoded_unicode = Base64.decode64(unicode).force_encoding('UTF-8')
# "café ☕ 日本語"

# Standard encode (adds line breaks every 60 chars)
long_encoded = Base64.encode64("A very long string " * 10)

# URL-safe Base64 encoding
url_safe = Base64.urlsafe_encode64("Hello, World!")

# URL-safe Base64 without padding
no_pad = Base64.urlsafe_encode64("Hello, World!", padding: false)

# URL-safe Base64 decoding
url_decoded = Base64.urlsafe_decode64(url_safe)

# Encode a file to Base64
file_b64 = Base64.strict_encode64(File.binread("image.png"))

# Decode Base64 to a file
File.binwrite("output.png", Base64.decode64(file_b64))

# Validate Base64 before decoding
begin
  Base64.strict_decode64(user_input)
rescue ArgumentError => e
  puts "Invalid Base64: #{e.message}"
end
using System;
using System.Text;

// Base64 encode a string
string encoded = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("Hello, World!")
);
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
string decoded = Encoding.UTF8.GetString(
    Convert.FromBase64String("SGVsbG8sIFdvcmxkIQ==")
);
// "Hello, World!"

// Encode Unicode/UTF-8 text
string unicode = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("café ☕ 日本語")
);
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

// Decode back to Unicode
string decodedUnicode = Encoding.UTF8.GetString(
    Convert.FromBase64String(unicode)
);
// "café ☕ 日本語"

// Validate Base64 before decoding
bool isValid = Convert.TryFromBase64String(
    userInput, new byte[256], out int bytesWritten
);

// Insert line breaks every 76 characters (MIME style)
string mime = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("Long content..."),
    Base64FormattingOptions.InsertLineBreaks
);

// Encode for Basic Authentication header
string credentials = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("username:password")
);
string header = $"Basic {credentials}";

// Encode a file to Base64
byte[] fileBytes = File.ReadAllBytes("image.png");
string fileB64 = Convert.ToBase64String(fileBytes);

// Decode Base64 to a file
File.WriteAllBytes("output.png", Convert.FromBase64String(fileB64));
using System;
using System.Text;

// Base64 encode a string
string encoded = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("Hello, World!")
);
// "SGVsbG8sIFdvcmxkIQ=="

// Base64 decode a string
string decoded = Encoding.UTF8.GetString(
    Convert.FromBase64String("SGVsbG8sIFdvcmxkIQ==")
);
// "Hello, World!"

// Encode Unicode/UTF-8 text
string unicode = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("café ☕ 日本語")
);
// "Y2Fmw6kg4piVIOaXpeacrOiqng=="

// Decode back to Unicode
string decodedUnicode = Encoding.UTF8.GetString(
    Convert.FromBase64String(unicode)
);
// "café ☕ 日本語"

// Validate Base64 before decoding
bool isValid = Convert.TryFromBase64String(
    userInput, new byte[256], out int bytesWritten
);

// Insert line breaks every 76 characters (MIME style)
string mime = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("Long content..."),
    Base64FormattingOptions.InsertLineBreaks
);

// Encode for Basic Authentication header
string credentials = Convert.ToBase64String(
    Encoding.UTF8.GetBytes("username:password")
);
string header = $"Basic {credentials}";

// Encode a file to Base64
byte[] fileBytes = File.ReadAllBytes("image.png");
string fileB64 = Convert.ToBase64String(fileBytes);

// Decode Base64 to a file
File.WriteAllBytes("output.png", Convert.FromBase64String(fileB64));

About Base64 Encoding

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of printable ASCII characters. It uses a 64-character alphabet (A-Z, a-z, 0-9, +, /) to represent data, with = used for padding. Every 3 bytes of input produce 4 characters of output, making the encoded result about 33% larger than the original.

How Base64 Encoding Works

The input is first converted to its binary representation. The binary stream is then split into groups of 6 bits, and each group is mapped to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of 3 bytes, the output is padded with one or two = characters to maintain alignment.

Unicode & Emoji Support

JavaScript's built-in btoa() only handles Latin-1 characters. This tool uses TextEncoder to convert text to UTF-8 bytes before encoding, so it correctly handles emoji, CJK characters, accented letters, and any other Unicode text without errors.

Common Use Cases

Base64 is widely used for embedding images in HTML/CSS via data URIs, encoding email attachments in MIME format, transmitting binary data in JSON or XML APIs, storing cryptographic keys and certificates, and encoding authentication tokens in HTTP headers (e.g., Basic Auth).

Frequently Asked Questions

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It converts every 3 bytes of input into 4 printable characters from a 64-character alphabet (A-Z, a-z, 0-9, +, /), with = used for padding. It is commonly used to embed binary data in text-based formats like JSON, HTML, and email.

Base64 is used whenever binary data needs to be stored or transferred over media that only support text. Common use cases include embedding images in CSS or HTML via data URIs, encoding email attachments (MIME), transmitting binary data in JSON APIs, and storing cryptographic keys or tokens.

Yes. Unlike the browser's built-in btoa() function which only handles Latin-1 characters, this tool first converts your text to UTF-8 bytes using TextEncoder before Base64 encoding. This means it correctly handles emoji (🎉), CJK characters (你好), accented letters (café), and any other Unicode text.

Yes. Click the upload button in the input panel to select any file. Text files (like .txt, .json, .csv) will be loaded as text. Binary files (images, videos, audio, PDFs, etc.) will show a preview and can be encoded directly to Base64. This is useful for creating data URIs or embedding files in JSON payloads.

No. All Base64 encoding and decoding happens entirely in your browser using JavaScript. Your data never leaves your device — there are no server requests, no logging, and no data collection of any kind.

JavaScript's built-in btoa() function can only encode strings where every character is a single byte (Latin-1 range). If you pass it a string with Unicode characters like emoji or CJK text, it throws an error. This tool uses TextEncoder to convert the string to UTF-8 bytes first, then Base64-encodes those bytes, so it works with any Unicode text.

A growing collection of fast, privacy-first developer utilities. All tools run in your browser — your data never leaves your device.

Tools

JSON ParserJSON Schema ValidatorJSON ConverterJSON to TypeScriptOpenAPI ViewerCode FormatterSQL FormattercURL ConverterTimestamp ConverterCron ParserURL EncoderQR Code ToolIP & CIDR CalculatorGzip & Deflate ToolJWT DecoderJWT Verify & JWK ToolHash GeneratorPassword & TOTPBase64 EncoderUUID GeneratorImage MetadataImage CompressionTiny Image CompressorImage Toolkit ProScreen RecorderRegex TesterText DiffMarkdown & Mermaid PreviewColor & Contrast Tool

Legal

Privacy PolicyTerms of Service

© 2026 ZPTools. All Rights Reserved.