Home › Developer Tools › Base64 Encoder Decoder

Base64 Encoder Decoder

Encode text or files to Base64, decode Base64 back to text or a file, and create data URIs for images. Everything runs in your browser.

Last updated:

0 characters
 
Advertisement
Advertisement

How to use the Base64 Encoder Decoder

  1. Text: type or paste text and press Encode, or paste Base64 and press Decode. With Live on, the result updates as you type.
  2. URL-safe: tick URL-safe to use - and _ instead of + and / and drop the = padding, as used in URLs and JWTs.
  3. Files and images: open the File to Base64 tab and drop a file. Copy the raw Base64, the data URI, or a ready-made HTML or CSS snippet.
  4. Base64 to file: paste Base64 or a data URI in the Base64 to File tab. The file type is detected, images are previewed, and you can download the file.

Base64 examples

InputBase64URL-safe Base64
Hello worldSGVsbG8gd29ybGQ=SGVsbG8gd29ybGQ
Café ☕Q2Fmw6kg4piVQ2Fmw6kg4piV
??>>Pz8+Pg==Pz8-Pg

Text is converted to UTF-8 bytes before encoding, so accents, emoji and non-Latin scripts round-trip correctly. That matches what most programming languages and APIs expect.

What is a data URI?

A data URI puts a whole file inside a link, in the form data:[type];base64,[data]. You can use one as the src of an image or as a CSS background, so small icons load without an extra request. For large images a normal file is usually better, because Base64 makes them about a third bigger and they can't be cached separately.

Frequently asked questions

What is Base64?

Base64 is a way to write any data, including images and files, using only 64 safe text characters (A to Z, a to z, 0 to 9, + and /). It is used to put binary data into JSON, emails, URLs, HTML and CSS.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.

Why is Base64 bigger than the original?

Every 3 bytes of data become 4 Base64 characters, so encoded data is about 33% larger than the original.

What is URL-safe Base64?

URL-safe Base64 (base64url) replaces + with - and / with _, and usually drops the = padding, so the result can be used in URLs, file names and JSON Web Tokens without escaping.

How do I convert an image to Base64?

Open the File to Base64 tab and drop your image. You get the Base64 text plus a data URI such as data:image/png;base64,… that you can paste straight into an img src or a CSS background.

Are my files uploaded?

No. Files are read and encoded locally in your browser and never leave your device.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.Binary TranslatorConvert text to binary, hex, octal and back.Password GeneratorCreate strong passwords and passphrases.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.API Request TesterSend GET, POST, PUT and DELETE requests with headers and a body, then inspect the response.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.Basic Auth Header GeneratorCreate an Authorization: Basic header from a username and password, or decode one.Bcrypt Hash Generator & CheckerCreate bcrypt password hashes and check a password against a hash.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.RSA Key GeneratorGenerate 2048, 3072 or 4096-bit RSA key pairs as PEM, PKCS#1, JWK or OpenSSH, locally.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.Text Encryption ToolEncrypt and decrypt text with a password using AES-256-GCM, entirely in your browser.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SHA-512 Hash GeneratorSHA-512 and SHA-384 hashes of text or files in hex or Base64, HMAC and hash verification.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UTF-8 Encoder / DecoderConvert text to UTF-8 bytes in hex, decimal, binary, \x or % and decode bytes back to text.Protobuf DecoderDecode raw Protocol Buffers hex or Base64 without a schema, or add a .proto for field names.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Playfair CipherEncrypt and decrypt Playfair ciphers from a keyword, with the 5x5 key square and every digraph step.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.
See all 65 Encoders, Hashes & Crypto →