Base64 Encoder

Convert text or a file into Base64, for data URIs, email attachments, basic-auth headers and APIs that only accept text.

  • Files stay on your device
  • Free, no sign-up
  • Instant
Quick guide · 3 steps

How to use the Base64 Encoder

When to use the Base64 Encoder

Embedding small images

Turn an icon into a data: URI to place directly in CSS or HTML without a separate request.

APIs and JSON

Send binary data, such as a small file or signature image, inside a JSON field.

Basic authentication headers

Encode username:password for an HTTP Basic Authorization header while testing an API.

Email and config

Encode text that must survive systems that only handle plain ASCII characters.

Features and benefits

  • Correct UTF-8 handling for accents and emoji
  • URL-safe variant (- and _ without padding)
  • Files of any type, with optional data: URI prefix
  • Shows output length and size

Example

Input
Hello, ConvertNest!
Output
SGVsbG8sIFRvb2xOZXN0IQ==

How the Base64 Encoder works

Base64 takes every three bytes of data and represents them as four characters from a 64-character alphabet: A–Z, a–z, 0 to 9, + and /. Text is first converted to UTF-8 bytes, so accented letters and emoji encode correctly. If the input length is not a multiple of three, = signs pad the end. URL-safe mode swaps + and / for - and _ and drops the padding so the result can sit in a URL.

A real-life example

A developer is testing an API that uses Basic authentication. He types api_user:Secr3t! into the text box and copies the result, YXBpX3VzZXI6U2VjcjN0IQ==, into an Authorization header as “Basic YXBpX3VzZXI6U2VjcjN0IQ==”. The request succeeds. He also remembers that Base64 is not encryption, so he only does this over HTTPS and never pastes the header into a public ticket.

Good to know

Base64 represents binary data using 64 safe text characters. It lets you put an image inside a CSS file, send a file through a JSON API, or include credentials in an HTTP header.

Base64 is encoding, not encryption. Anyone can decode it, so never treat it as a way to hide passwords or secrets.

Encoded output is about 33% larger than the original. For images on websites, a normal image file is usually better than a Base64 data URI unless the image is tiny.

Tips for the best results

  1. Base64 output is about 33% larger than the original, keep embedded images small.
  2. Turn on the data: URI option when you want to paste an image straight into HTML or CSS.
  3. Use URL-safe mode for tokens or values that go into a link.
  4. Check the output length if a system has a field size limit.

Common mistakes to avoid

Treating Base64 as security

Anyone can decode it in a second. Use proper encryption for secrets.

Embedding large photos as Base64

It makes pages heavier and stops browsers caching the image separately.

Mixing standard and URL-safe variants

A decoder expecting one may reject the other. Use the variant the receiving system expects.

When to use Base64

Quick answer: paste text or pick a file and press Encode. Base64 turns any data into plain letters and numbers so it can travel safely in JSON, email, URLs or HTML. It is about 33 percent bigger than the original.

  • Small images inline: data URIs in CSS or HTML for icons under a few KB
  • API payloads: sending files inside JSON
  • Basic auth headers: user:password encoded, which is not encryption
  • Decode it again with Base64 Decode. Background: what is Base64.

Base64 Encoder, frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding that anyone can decode. Use proper encryption to protect sensitive data.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / and drops the = padding, so the result can be used in URLs and file names without escaping.

How do I embed an image with Base64?

Choose File, drop the image and keep “Output as data URI” ticked. Paste the result into an img src attribute or a CSS url().

Why does my encoded text differ from another tool?

Some tools encode text as Latin-1 instead of UTF-8. ConvertNest uses UTF-8, the standard for the web, so accents and emoji encode correctly.

Why does Base64 end with = or ==?

Padding shows that the last group had only one or two bytes of real data.

Can I encode a PDF or ZIP file?

Yes. Choose a file of any type and the encoded text appears in the output box.

Is Base64 secure

No. It is an encoding, not encryption. Anyone can decode it instantly.

What is URL safe Base64

A version that uses - and _ instead of + and /, so the result can go in a URL without extra escaping.