Base64.imBase64 Online Encoding and Decoding

The most practical Base64 online tool, supporting various advanced functions for Base64 encoding or decoding.

0
Ctrl + Enter
0
Ready when you are.

Image to Base64

Choose or drop up to 20 images. Maximum 10 MB each.

Advanced settings
Symbol replacement
Code examples

JavaScript (UTF-8)

const bytes = new TextEncoder().encode(text);
const encoded = btoa(Array.from(bytes, b => String.fromCharCode(b)).join(""));
const decoded = new TextDecoder().decode(Uint8Array.from(atob(encoded), c => c.charCodeAt(0)));

Python 3

import base64
encoded = base64.b64encode(text.encode("utf-8")).decode("ascii")
decoded = base64.b64decode(encoded).decode("utf-8")

Java

String encoded = Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8));
String decoded = new String(Base64.getDecoder().decode(encoded), StandardCharsets.UTF_8);

PHP

$encoded = base64_encode($text);
$decoded = base64_decode($encoded, true);

C# / .NET

string encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(text));
string decoded = Encoding.UTF8.GetString(Convert.FromBase64String(encoded));

Go

encoded := base64.StdEncoding.EncodeToString([]byte(text))
decoded, err := base64.StdEncoding.DecodeString(encoded)

Ruby

require "base64"
encoded = Base64.strict_encode64(text)
decoded = Base64.strict_decode64(encoded)

Perl

use MIME::Base64;
$encoded = encode_base64($text, "");
$decoded = decode_base64($encoded);

MySQL / MariaDB

SELECT TO_BASE64('hello');
SELECT FROM_BASE64('aGVsbG8=');

PostgreSQL

SELECT encode(convert_to('hello', 'UTF8'), 'base64');
SELECT convert_from(decode('aGVsbG8=', 'base64'), 'UTF8');

Linux shell

printf '%s' 'hello' | base64
printf '%s' 'aGVsbG8=' | base64 --decode

FAQ

Is Base64 encryption?

No. Base64 is a reversible representation of bytes, not encryption. Anyone can decode it. It does not protect secrets.

Why does decoding fail?

Check the input and character encoding. Binary data may not be valid text: choose hexadecimal or byte-array output. URL-safe Base64 is also accepted.

Are my files uploaded?

Conversion takes place in your browser. Text and image contents are not sent to a conversion server.