Converters

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to plain text instantly — handy for data URIs, API tokens and email attachments.

Output

About Base64

Encodes text to Base64 or decodes Base64 back to plain text. Base64 shows up constantly in places that aren't obvious from the encoded string alone — embedded images in HTML/CSS, Basic Auth credentials in HTTP headers, JWT payload segments, email attachment encoding. Worth remembering that Base64 is an encoding, not encryption — decoding it requires no key or secret, so anything sensitive shouldn't be considered protected just because it's been Base64-encoded.

Base64 output is roughly 33% larger than the original input — worth accounting for when estimating payload size for something like an embedded image or an API request body.

📖 Read more in our Knowledge Base →

How Base64 works

Base64 takes every 3 bytes (24 bits) and writes them as 4 characters from a 64-character alphabet: A–Z a–z 0–9 + /. When the input isn't a multiple of 3 bytes, = padding fills the last group. That's why the output is about a third larger than the input. Text is converted to UTF-8 bytes first, so Cyrillic, Turkish or emoji characters encode and decode correctly here.

Standard vs URL-safe

+ and / have meanings in URLs and file names, so the URL-safe variant (RFC 4648 §5) replaces them with - and _ and usually drops the = padding. JWTs, many API tokens and signed URLs use it. Tick URL-safe to produce or read that form. If a decode fails with an "invalid character" error and the string contains - or _, it is URL-safe Base64.

Where you meet it

  • HTTP Basic auth: Authorization: Basic dXNlcjpwYXNz is just user:pass. Anyone who sees the header can read the password, so use it only over HTTPS.
  • Data URIs: data:image/png;base64,… embeds a file in HTML or CSS.
  • Email: attachments and non-ASCII bodies use Content-Transfer-Encoding: base64; see the Email Header Analyzer.
  • DKIM keys and JWTs: the p= value in a DKIM record and each part of a JWT.

On the command line

  • Linux / macOS: printf %s 'text' | base64 and base64 -d (-D on older macOS).
  • PowerShell: [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('text'))

Encoding and decoding happen in your browser; nothing is sent to our server.