Skip to content

A–Z a–z 0–9 + / = · base64url

Base64 encoder and decoder

Base64 writes bytes as text with 64 printable characters: the 5 bytes of "Hello" become SGVsbG8=. Type text or choose a file to encode it, or paste Base64 to turn it back into text or a download.

Everything runs in this tab and nothing is uploaded. Base64 is an encoding, not encryption: anyone can reverse it.

Scanned by NortonTM Safe Web

At a glance

Price
No charge
Account
None needed
Standards
RFC 4648 (Base64 and Base64url), RFC 2045 (MIME), RFC 2397 (data URI)
Size change
4 characters for every 3 bytes
Limit
10 MB for a text or a file
Upload
None — text and files stay in your browser tab

Base64 examples

Every value below is produced by the encoder on this page. Text is encoded as UTF-8 first.

Text in Base64 and Base64url
TextBase64Base64url without paddingUTF-8 size
HelloSGVsbG8=SGVsbG85 B
Hello, World!SGVsbG8sIFdvcmxkIQ==SGVsbG8sIFdvcmxkIQ13 B
GrüßeR3LDvMOfZQ==R3LDvMOfZQ7 B
€4oKs4oKs3 B
FB FF+/8=-_82 B
Test vectors from RFC 4648
InputBase64LengthPadding characters
fZg==42
foZm8=41
fooZm9v40
foobZm9vYg==82
foobaZm9vYmE=81
foobarZm9vYmFy80

How to encode and decode Base64

1

Pick a direction

Choose Encode to turn text or a file into Base64, or Decode to turn Base64 back into the original. The Swap button moves the result into the other direction.

2

Enter the data

Type or paste text, or drop a file of up to 10 MB. For decoding, paste Base64 in the standard or the URL-safe alphabet, with or without = padding, or a data URI.

3

Copy the result

Copy or download the result. If the decoded bytes are not text, the page shows the first bytes in hex, names the file type when it knows it, and lets you save the bytes as a file.

How Base64 works

Base64 (RFC 4648) splits the input into groups of 3 bytes, which is 24 bits, and writes each group as 4 characters of 6 bits each from a 64-character alphabet: A–Z, a–z, 0–9, + and /. The output is therefore about a third larger than the input. When the input is not a multiple of 3 bytes, = signs pad the end to a multiple of 4 characters, so the 5 bytes of Hello give 8 characters ending in one =.

Base64url, defined in the same RFC, replaces + with - and / with _ so the text is safe in a URL or a file name, and formats such as JWT drop the = padding. This page reads either alphabet, with or without padding, and ignores spaces and line breaks. Text is converted to UTF-8 first, so € becomes the 3 bytes E2 82 AC and 4oKs in Base64. The limit is 10 MB for a text or a file.

Base64 questions

How do I encode text to Base64?

Type or paste the text in Encode mode. The Base64 appears as you type: Hello gives SGVsbG8=. The text is written as UTF-8 first, so characters outside ASCII use more than one byte: € is 3 bytes and gives 4oKs.

What is the difference between Base64 and Base64url?

Base64url swaps two characters: - replaces + and _ replaces /. The bytes FB FF are +/8= in Base64 and -_8= in Base64url. The URL-safe form is meant for URLs, file names and JWT, and often leaves out the = padding.

Why does Base64 end with = signs?

They are padding. Base64 works in groups of 3 bytes and 4 characters. If the last group has 1 byte, two = signs fill it: f gives Zg==. If it has 2 bytes, one = fills it: fo gives Zm8=. A multiple of 3 bytes needs none: foo gives Zm9v.

Is Base64 encryption?

No. Base64 is a reversible encoding with no key, so anyone can decode it, and it does not protect data. It makes binary data safe to place in text such as email, JSON, XML or a data URI.

How much bigger does Base64 make my data?

About one third bigger: every 3 bytes become 4 characters, so 3000 bytes give 4000 characters. Line breaks every 76 characters (MIME, RFC 2045) or every 64 characters (PEM, RFC 7468) add a little more.

Why does decoding say the bytes are not valid UTF-8 text?

The Base64 itself is fine, but the bytes inside are not text. They may be an image, a compressed file or another binary format. The page then shows the first 64 bytes in hex, names the file type if it knows it, and offers the bytes as a download.