Skip to content
FreeToolsNexus
Developer Tools

Base64 Encode & Decode

Encode and decode Base64 for text and files, with URL-safe mode — privately in your browser.

Your data never leaves your browser.

0 characters · 0 bytes

0 characters · 0 bytes

What is Base64?

Base64 is a binary-to-text encoding that represents bytes using a set of printable ASCII characters. It lets binary content travel through text-only formats such as JSON, HTML, email, and URLs, but it does not compress or protect that content. The transformation is reversible and needs no key. This tool encodes UTF-8 text or any file into standard or URL-safe Base64, and decodes either alphabet—including unpadded input with whitespace—back to text or a downloadable file. Although convenient for transport, Base64 is not a storage format and does not conceal data from someone who can read it. Everything is processed in your browser; your input is not uploaded or saved.

How Base64 encoding works

The encoder reads bytes in groups of three. Those three bytes contain 24 bits, which are split into four 6-bit values; each value selects one character from the Base64 alphabet: A–Z, a–z, 0–9, plus and slash. If the last group contains only one or two bytes, the unused bits are filled with zeroes and one or two equals signs are added as padding. Padding tells a decoder how many original bytes were present. Since every three input bytes become four Base64 characters, encoded data is about 33% larger before padding.

Standard vs URL-safe Base64

Standard Base64 uses plus (+) and slash (/). URL-safe Base64 substitutes hyphen (-) and underscore (_), avoiding characters that have special meaning in URLs and some filenames. Both forms represent the same bytes, and this decoder accepts either alphabet. URL-safe values may omit equals-sign padding; JSON Web Tokens (JWTs) use this unpadded Base64URL form for their segments.

Worked example

The text Hello, World! encodes to SGVsbG8sIFdvcmxkIQ== in standard Base64.

For a value that differs between alphabets, the UTF-8 text ÿÿ encodes to w7/Dvw== in standard Base64 and w7_Dvw== in URL-safe Base64. The underscore replaces the slash; optional padding can be removed in URL-safe mode.

Common uses

Base64 is commonly used in data URIs to embed images or other small files in HTML and CSS, to represent binary email attachments, and to carry credentials in HTTP Basic authentication. JWT header, payload, and signature segments use Base64URL. These formats make binary bytes easier to transport as text; they do not make the contents private.

Base64 is not encryption

Anyone can decode Base64 without a password or secret key. Do not use it to hide passwords, tokens, personal information, or other sensitive data. Use established encryption when confidentiality is required.

Frequently asked questions

Is my data uploaded?

No. Text and file encoding or decoding runs locally in your browser. Your input is not sent to a server or stored by this tool.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can reverse it without a key, so it must not be used to protect sensitive information.

Why does the output end with =?

Equals signs are padding. Base64 maps groups of three bytes to four characters, and padding marks a final group that contained only one or two bytes. Some Base64URL formats omit it.

What is URL-safe Base64?

URL-safe Base64 replaces plus with hyphen and slash with underscore so values work more conveniently in URLs and filenames. JWT segments use this variant and commonly omit padding.

Why is the Base64 file larger than the original?

Each group of three bytes becomes four Base64 characters, increasing the encoded size by roughly one third, plus any final padding.

Why do I get invalid Base64 errors?

The input may contain characters outside the Base64 alphabets, an impossible length, or misplaced padding. This decoder ignores whitespace and accepts standard or URL-safe characters, with or without valid padding.

Guides