🔤 Base64 Encoder/Decoder

Encode text, images, and files to Base64 format with drag-and-drop support

📝 Input No Input
📤 Output No Output
Encoded/decoded output will appear here...

💡 Sample Data

Try these examples to test the encoder/decoder:

About Base64 Encoder/Decoder

Our free online Base64 encoder and decoder helps developers convert text, images, and files to Base64 format and vice versa. Whether you're embedding images in HTML, encoding binary data, or working with API responses, our tool provides comprehensive Base64 conversion capabilities.

Features

How to Use

  1. Choose between text input or file upload mode
  2. Enter text or upload a file to encode
  3. Select output format (Base64 or Data URL)
  4. Click "Encode to Base64" or "Decode from Base64"
  5. Copy or download the result

Common Use Cases

About this tool

Free Online Base64 Encoder and Decoder

Base64 encodes binary data (or any text) into a string of 64 safe ASCII characters — A–Z, a–z, 0–9, +, and / — making it safe to transmit in contexts that only support text: HTTP headers, JSON payloads, email, and data URIs. NeatJSON's encoder and decoder runs entirely in your browser with no uploads.

How Base64 Works

Base64 takes 3 bytes of input (24 bits) and splits them into four 6-bit groups. Each group maps to one of 64 printable characters. The result is always about 33% larger than the input. If the input length isn't a multiple of 3, = padding characters fill the output to a multiple of 4.

Base64 is not encryption. Anyone can decode a Base64 string without a key. Never use it to hide sensitive data.

When to Use Base64

How do I Base64-encode a string in JavaScript?

Use btoa('hello')'aGVsbG8='. For Unicode, encode first: btoa(encodeURIComponent('héllo')). To decode: atob('aGVsbG8='). Modern code can also use TextEncoder with Uint8Array for full binary support.

Why does Base64 output end in = or ==?

Padding. Base64 encodes 3 bytes at a time. If the input isn't divisible by 3, = signs pad the output to a multiple of 4 characters. One = means 2 padding bits; two == means 4 padding bits.

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and /, which have special meaning in URLs. Base64URL replaces them with - and _ for safe use in URLs and headers without percent-encoding. JWTs use Base64URL.

Learn more: Base64 Encoding Explained

Related Tools

More Dev Tools

Bcrypt GeneratorColor PickerCron ParserCSS MinifierCSV ⇄ JSONHash Generator

Want more detail? Read What Is Base64 Encoding? A Complete Developer's Guide.