Base64 Encoder / Decoder - Convert Text and Data to Base64

Encode and decode Base64 strings directly in your browser. Supports UTF-8 text and URL-safe Base64. Fully client-side processing — no data is sent to a server. Essential developer tool for working with APIs, JWT tokens and data URLs.

Note:All generated data is entirely fictional and not suitable for use as real personal information.

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, + and / (with = as padding). Every 3 bytes of input produce exactly 4 Base64 characters, resulting in a roughly 33% size increase compared to the original data.

The encoding works by taking 3 bytes (24 bits) of input, splitting them into four 6-bit groups, and mapping each group to one of the 64 Base64 characters. This process makes binary data safe to transmit over channels that only support text.

Common use cases for Base64

  • Data URIs — Embed images, fonts or other binary assets directly in HTML/CSS as data:image/png;base64,.... Eliminates extra HTTP requests.
  • HTTP Basic Authentication — The Authorization: Basic header carries Base64-encoded credentials in the format username:password.
  • JWT tokens — JSON Web Tokens use URL-safe Base64 (Base64url) to encode the header and payload sections.
  • Email attachments — MIME email attachments are Base64-encoded to safely transmit binary files over SMTP.
  • API payloads — Binary data such as images or PDFs sent via REST APIs is often Base64-encoded to fit in JSON strings.

Base64 vs URL-safe Base64

Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 (Base64url, used in JWT and OAuth) replaces these with - and _, and typically omits the trailing = padding. Use the URL-safe variant when working with OAuth tokens, JWTs, or when embedding encoded data in query parameters.

Base64 is encoding, not encryption

Base64 provides no security— it is trivially reversible by anyone who sees the encoded string. Never use Base64 to “secure” sensitive data such as passwords or API keys. For security, use proper hashing (bcrypt, Argon2) or encryption (AES). Base64 is purely a data transport format.

Frequently Asked Questions

What is Base64 and what is it used for?
Base64 is an encoding method that converts binary data into an ASCII string of 64 characters (A-Z, a-z, 0-9, + and /). It is widely used in software development: in email encoding (MIME), data URLs for embedding images in HTML/CSS, JWT tokens for authentication, API communication where binary data needs to be sent via JSON, and storing binary data in text formats like XML or CSV.
Is my data sent to a server when encoding or decoding?
No, absolutely not. All Base64 encoding and decoding takes place entirely client-side in your browser using the built-in btoa() and atob() functions. No data is sent to a server. This makes the tool safe for processing sensitive data such as API keys, tokens or other confidential information.
Does the tool support UTF-8 text with special characters?
Yes. The encoder correctly processes UTF-8 text, including special characters, emojis and other Unicode characters. The text is first converted to UTF-8 bytes before Base64 encoding takes place, following the standard practice in modern web applications.
What is the difference between standard Base64 and URL-safe Base64?
Standard Base64 uses the characters + and / which have special meaning in URLs. URL-safe Base64 (also called Base64url) replaces + with - and / with _, making the output safe for use in URLs and filenames. This format is used in JWT tokens and OAuth parameters, among others. The tool supports both variants.
How do I use Base64 encoding when working with APIs?
Base64 encoding is common in API integrations: HTTP Basic Authentication requires a Base64-encoded username:password combination, JWT tokens consist of Base64url-encoded segments, binary files are sent as Base64 strings in JSON payloads, and webhook signatures often use Base64-encoded HMAC hashes. This tool helps you quickly encode and decode values during development and debugging.

Related Tools