Loading Base64URL Encoder...
Please wait a moment

How to Use Base64 URL Encoder - Step by Step Guide

Step 1

Input Your Text

Enter the text you want to encode into URL-safe Base64 format. This encoding is essential for JWT tokens and web APIs:

•
Type or paste: Enter your text directly into the input area
•
Upload a file: Click "Upload" to pick any file; its raw bytes are encoded, so images work too
•
Try the sample: Click "Sample" to load example data

Example: Input Text

Here's an example input text:

Hello World! Testing +/= characters
Step 2

Automatic Encoding

The tool automatically converts your text to URL-safe Base64 format as you type:

•
Updates as you type: The result changes with every edit, no button to press
•
URL-safe format: Special characters (+, /, =) are replaced with (-, _, no padding)
•
RFC 4648 compliant: Follows official Base64url standard

Example: Standard vs URL-Safe Base64

Standard Base64 (NOT URL-safe):

SGVsbG8gV29ybGQhIFRlc3RpbmcgKy89IGNoYXJhY3RlcnM=

Contains = padding, unsafe for URLs

URL-Safe Base64 (Base64url):

SGVsbG8gV29ybGQhIFRlc3RpbmcgKy89IGNoYXJhY3RlcnM

No padding, safe for URLs and filenames

Step 3

Copy or Download Result

Get your encoded Base64url string ready for use:

•
Copy to clipboard: One-click copying for quick use in your applications
•
Download as file: Save the encoded result as a text file
•
Use in URLs: Safely embed in URLs, JWT tokens, and API calls

What is Base64 URL-Safe Encoding?

Base64 URL encoding (Base64url) is a URL-safe variant of standard Base64 encoding that replaces URL-unsafe characters with alternatives that can be safely used in URLs, filenames, and HTTP headers. This encoding standard is defined in RFC 4648 Section 5.

Key Differences:

•
Standard Base64: Uses + and / characters, includes = padding
•
URL-safe Base64: Replaces + with -, / with _, removes = padding
•
Result: Safe to use in URLs, filenames, and HTTP headers without escaping

Common Use Cases for Base64url

Base64url encoding is essential for modern web development and is used extensively in:

•
JWT (JSON Web Tokens): Header and payload sections of JWTs use Base64url encoding
•
OAuth 2.0: Authorization codes and tokens in OAuth flows
•
URL Parameters: Encoding binary data in query strings and path segments
•
REST APIs: Transmitting binary data in API requests and responses
•
HTTP Headers: Encoding credentials and metadata in HTTP headers

Frequently Asked Questions

What is the difference between Base64 and Base64url?

Only three characters. Base64url writes - where Base64 writes +, _ where it writes /, and drops the = padding at the end. The bytes underneath are the same, so José 😀 is Sm9zw6kg8J+YgA== in plain Base64 and Sm9zw6kg8J-YgA here. If you need the classic alphabet with padding, use the Base64 Encoder instead.

When should I use URL-safe Base64?

Whenever the encoded value ends up in a URL path or query string, a cookie, a file name or a JWT. In those places + can turn into a space, / looks like a path separator and = has to be escaped, so the plain alphabet tends to break in quiet ways.

Can I get it back again, and does the missing padding matter?

Yes, it decodes back to exactly the bytes you put in. Most decoders, including Node's Buffer.from(value, 'base64url') and Python's base64.urlsafe_b64decode once you add the = back, work out the length from the string itself. To check a result, paste it into the Base64URL Decoder.

Does this produce the same header and payload as jwt.io?

For the same bytes, yes. A JWT header is the Base64url of its JSON text, so {"alg":"HS256","typ":"JWT"} typed exactly like that gives eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9, the familiar start of most tokens. Spaces and line breaks count, though: pretty-printed JSON gives a different string. This page only encodes; it does not sign anything, so it will not make the third part of a token.

What happens with accents, emoji and uploaded files?

Text is converted to UTF-8 before encoding, which is what JWT libraries and most servers expect, so accents, emoji and other scripts decode back correctly. An uploaded file is encoded from its raw bytes, so an image or a file with a byte order mark comes out exactly as it is on disk.

Is Base64url safer than regular Base64, and does my data leave the browser?

It is not safer. Base64url is an encoding, not encryption, and anyone can decode it in a second, so don't use it to hide passwords or keys. The encoding itself runs in your browser and nothing you type or upload is sent to our server. Very large inputs can get slow, because the result has to fit in the editor.