Instant Encoding · URL Validation · Decode Included

URL to Base64 Encoder

Paste any URL and get a Base64 string instantly with live URL validation, scheme detection, and a breakdown of every URL component. Includes a Base64 → URL decode tab. Nothing ever leaves your browser.

https:// http:// ftp:// mailto: data: Custom schemes Query strings
URL Components
Original URL 0 chars
Your URL will appear here…
Base64 Output 0 chars
Base64 output will appear here…
7+
URL Schemes
4
Code Snippets
0ms
Server Latency
100%
Private & Secure

Encode a URL to Base64 in Three Steps

No sign-up, no server uploads. Paste, encode, and copy in seconds.

1

Paste Your URL

Enter any URL into the input field https://, http://, ftp://, mailto:, data:, or any custom scheme. The tool validates the URL in real time and displays a breakdown of every component: scheme, host, path, query parameters, and fragment.

2

Instant Base64 Encoding

The URL string is converted to UTF-8 bytes via the browser's native TextEncoder API and then encoded to Base64 using btoa(). Encoding updates with every keystroke. The output is a standard Base64 string not Base64url suitable for JSON payloads, HTTP headers, and storage fields.

3

Copy, Download, or Use a Snippet

Copy the raw Base64 string, download it as a .txt file, or switch to the Snippets tab for ready-to-paste JavaScript btoa(), Python base64.b64encode(), Node.js Buffer, and curl code blocks all pre-filled with your encoded URL.

Everything You Need to Encode a URL

A complete URL encoding toolkit with live validation, component breakdown, decode tab, and developer snippet generation.

🔗

Live URL Validation

The input field validates your URL in real time using the browser's native URL API, highlighting valid URLs in green and flagging invalid input. The scheme is detected automatically and shown as a badge inside the input field.

📈

URL Component Breakdown

For every valid URL, the tool displays a live breakdown of all components scheme, host, pathname, query string, and fragment in labelled chips beneath the input. Instantly see what each part of your URL looks like before encoding.

🔓

Built-in Base64 Decoder

The Decode tab lets you paste any Base64 string and decode it back to the original URL. An Open URL button appears automatically for decoded URLs that use web-safe schemes (https://, http://), letting you visit the link in one click.

💻

4 Developer Code Snippets

One-click copy for: JavaScript btoa() with TextEncoder, Python base64.b64encode(), Node.js Buffer.from(), and a curl command with the encoded URL as a JSON field all pre-filled with your URL.

📋

One-Click Copy & Download

Copy the raw Base64 string to your clipboard in one click, or download it as a .txt file. The live character counter helps you stay within API payload field limits before copying.

🔒

100% Private

All encoding and decoding uses native browser APIs TextEncoder, btoa(), atob(). Your URL is never sent to any server. Safe for internal endpoints, authenticated URLs, signed URLs, and private API addresses.

URL Schemes & Encoding Notes

Any URL scheme can be Base64 encoded. Here is a reference for the most common schemes and their encoding considerations.

SchemeExampleURL API ValidOpen URLCommon use
🔒https://https://example.com/path?q=1YesYesStandard secure web URLs APIs, webhooks, web pages
🌐http://http://localhost:3000/apiYesYesLocal dev servers, legacy HTTP endpoints
📄ftp://ftp://files.example.com/dir/YesClient dependentFile transfer protocol addresses
💌mailto:mailto:[email protected]YesOpens mail clientEmail links embedded in HTML and APIs
📁data:data:text/plain;base64,SGVsbG8=YesBrowser tabInline data URIs double-encoding for transport
🔗custom://myapp://deeplink/screen?id=42PartialApp dependentMobile app deep links, Electron, custom protocols
🛠Any stringurn:isbn:0451450523URN / relativeNoURNs, relative paths, opaque URI strings

When You Need a URL as Base64

Encoding URLs as Base64 solves real problems in API design, authentication, redirect flows, and data transport.

01

Passing URLs as Query Parameters

When a URL needs to be passed as the value of another URL's query parameter such as a redirect_uri, callback_url, or return_to parameter percent-encoding can produce ambiguous results when nested. Base64-encoding the inner URL produces a safe, unambiguous ASCII string with no special characters that interfere with query string parsing in any language or framework.

02

OAuth 2.0 & OIDC Redirect URIs

OAuth and OpenID Connect flows frequently pass redirect_uri values through multiple hops authorization servers, proxies, and callback handlers. Base64-encoding the redirect URI ensures it survives multi-hop URL encoding/decoding without being corrupted, truncated, or rejected by servers that apply double percent-decoding to query parameter values.

03

Storing URLs in Databases & Config Files

URLs containing special characters (&, =, ?, #, quotes) can cause parsing issues in CSV files, .env files, INI configs, YAML, and XML. Base64-encoding URLs before storage eliminates all special characters, producing a clean ASCII string that can be stored in any text field and decoded at runtime without ambiguity.

04

Embedding URLs in JSON API Payloads

Some APIs, webhooks, and message queue systems transmit URLs inside JSON string fields. While JSON handles most characters correctly, very long URLs with complex query strings can cause issues with certain JSON parsers, logging systems, and proxy layers. Base64-encoding the URL field ensures it is always treated as an opaque string, regardless of its content or length.

05

Mobile App Deep Links & Universal Links

Mobile deep links and universal links often carry destination URLs as parameters for example, myapp://open?url=https%3A%2F%2F…. Double percent-encoding deep link parameters is notoriously fragile across iOS and Android URL handlers. Base64-encoding the destination URL produces a clean, single-token parameter value that app deep link handlers can safely pass and decode without percent-encoding conflicts.

06

Obfuscating Webhook & Callback Endpoints

Internal webhook receiver URLs, signed callback URLs, and temporary API endpoints are sometimes Base64-encoded before being passed in email links, SMS messages, or QR codes. While Base64 is not a security mechanism, encoding a URL prevents casual inspection of the endpoint structure in logs, referrer headers, and browser history, and reduces the risk of the URL being accidentally modified in transit.

URL to Base64 Encoding Explained

A URL is a text string, so encoding it to Base64 follows the same two-step process as any text: the string is first converted to bytes using a character encoding (UTF-8 by default), and those bytes are then Base64-encoded. The result is a standard Base64 string composed entirely of A–Z, a–z, 0–9, +, /, and = padding characters.

It is important to distinguish Base64 encoding a URL from URL encoding (percent-encoding) and from Base64url encoding. Percent-encoding (encodeURIComponent()) replaces unsafe characters with %XX hex sequences so a string can be safely embedded in a URL. Base64url is a variant of Base64 that replaces + with - and / with _ to make the output safe for use directly inside URLs. Standard Base64 (as produced by this tool) is appropriate for HTTP headers, JSON fields, and storage not for embedding directly in a URL without further encoding.

The browser's URL API is used to parse and validate the input and extract its components. TextEncoder converts the URL string to UTF-8 bytes, and btoa() encodes the byte string to Base64. The decode tab reverses this with atob() and TextDecoder.

// URL → Base64 (UTF-8)
 
function urlToBase64(url) {
  const bytes = new TextEncoder()
    .encode(url);
  const bin = String.fromCharCode
    (...bytes);
  return btoa(bin);
}
 
// Base64 → URL (decode)
function base64ToUrl(b64) {
  const bin = atob(b64);
  const bytes = Uint8Array
    .from(bin, c => c.charCodeAt(0));
  return new TextDecoder()
    .decode(bytes);
}

Frequently Asked Questions

Everything you need to know about encoding URLs to Base64.

URL encoding (percent-encoding) converts unsafe characters in a string to %XX hex sequences so the string can be safely embedded inside a URL (e.g. a query parameter value). Base64 encoding converts the entire URL string to a Base64 ASCII string using a 64-character alphabet the result is not a valid URL itself, but a portable text token. Use URL encoding when you need a string to be part of a URL; use Base64 encoding when you need to safely transport or store the URL as an opaque value in a header, JSON field, or database column.
Base64url is a URL-safe variant of Base64 that replaces + with - and / with _, and omits = padding. It is used in JWTs, OAuth tokens, and anywhere the encoded output will appear inside a URL. This tool produces standard Base64 (RFC 4648 §4), which uses + and / and includes = padding. To convert this tool's output to Base64url: replace +-, /_, and strip trailing = characters.
No. Base64 is an encoding scheme, not an encryption algorithm. Anyone with the Base64 string can decode it back to the original URL using any Base64 decoder. It provides no confidentiality or security. If you need to protect a URL from being read or tampered with, use HMAC signing (as in signed URLs) or encryption. Base64 encoding a URL is useful for safe transport and storage not for hiding its content.
Use the Decode tab on this page paste your Base64 string and the original URL is restored instantly. In JavaScript: use atob(b64) for ASCII-only URLs, or new TextDecoder().decode(Uint8Array.from(atob(b64), c => c.charCodeAt(0))) for full UTF-8 support. In Python: base64.b64decode(s).decode('utf-8'). In Node.js: Buffer.from(s, 'base64').toString('utf-8').
Yes. This tool treats the URL as a plain string and encodes whatever characters are in it including percent signs, Base64 characters, query parameters, and fragments. A URL like https://example.com?data=SGVsbG8%3D will be encoded as-is. The Base64 output will represent the full URL string including all its existing encoding. When you decode it back, you will get the original URL with its percent-encoding and Base64 content intact.
Different Base64 outputs for the same URL can happen for two reasons: (1) the character encoding used to convert the URL to bytes before Base64 encoding this tool uses UTF-8, but some tools use Latin-1; (2) line wrapping some tools insert newlines every 76 characters per MIME standard (RFC 2045), while this tool produces a single continuous line. Make sure the tool you use to decode matches the encoding and line-wrap settings of the tool that encoded the URL.
No. All encoding and decoding uses native browser APIs TextEncoder, btoa(), atob(), and the browser's URL parser. No network requests are made and your URL never leaves your browser. This makes the tool safe for encoding internal API endpoints, authenticated URLs with tokens, private signed URLs, and any URL that should not be logged or exposed to third parties.
Standard Base64 output contains +, /, and = characters which have special meaning in URLs. Before embedding a Base64 string as a query parameter value, percent-encode it: encodeURIComponent(base64String) in JavaScript. Alternatively, convert the output to Base64url first (replace +-, /_, strip =) and then it can be used in a URL without additional encoding.