base64app.com

URL-safe base64 encoding

Replace +/ with -_ and strip padding for JWTs and URLs.

Why url safe base64?

URL-safe base64 encoding is one of the most common tasks developers hit when working with APIs, files, email attachments, and data URIs.

More Base64 guides on base64app — with copy-paste code and a free browser tool you can use without installing anything.

Quick reference

Base64 maps every 3 bytes to 4 ASCII characters. Padding with = may appear at the end. URL-safe variants swap +/ for -_.

When in doubt, paste your string into the tool below — base64app auto-repairs whitespace, data: prefixes, and padding issues.

Copy-paste code

URL-safe base64

const std = btoa('Hello');
const urlSafe = std.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');

JWT payload (base64url)

const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIn0.sig';
const payload = JSON.parse(atob(token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/')));
console.log(payload);

Related guides