skip to main content

-- Encode and decode your text in Base64, ideal for APIs and development --
updated: reading time: 3 minutes339 words

Usage #

Use this free Base64 encoder and decoder to easily convert between plain text and Base64-encoded strings. This tool is perfect for decoding API responses. No sign-up required — just paste your data and convert instantly.

How to use the Base64 decoding tool: #

You can use this tool to decode Base64-encoded strings, or to convert Base64 text strings back to their original binary string. Just paste your data and copy the result.

Use cases: #

  • Data conversion: Convert text strings back to their original binary form, useful for processing encoded text data.
  • Debugging: Decode Base64 data when troubleshooting or analyzing web resources.

Using Base64 in JavaScript: #

In JavaScript, Base64 encoding and decoding can be done using the native btoa and atob functions, as shown below:

const text = "Hello, world!";
const encoded = btoa(text);
console.log(encoded); // Résultat: "SGVsbG8sIHdvcmxkIQ=="
const encoded = "SGVsbG8sIHdvcmxkIQ==";
const decoded = atob(encoded);
console.log(decoded); // Résultat: "Hello, world!"

Using Base64 in TypeScript (Node.js): #

In TypeScript with Node.js, Base64 encoding and decoding can be done using the native Buffer class, as shown below:

const text: string = "Hello, world!";
const encoded: string = Buffer.from(text).toString("base64");
console.log(encoded); // Résultat: "SGVsbG8sIHdvcmxkIQ=="
const encoded: string = "SGVsbG8sIHdvcmxkIQ==";
const decoded: string = Buffer.from(encoded, "base64").toString(
  "utf-8"
);
console.log(decoded); // Résultat: "Hello, world!"

Using Base64 in Rust: #

In Rust, Base64 encoding and decoding can be done using the base64 crate, as shown below:

use base64::{Engine as _, engine::general_purpose};
 
let text = "Hello, world!";
let encoded = general_purpose::STANDARD.encode(text);
println!("{}", encoded); // Résultat: "SGVsbG8sIHdvcmxkIQ=="
use base64::{Engine as _, engine::general_purpose};
 
let encoded = "SGVsbG8sIHdvcmxkIQ==";
let decoded = general_purpose::STANDARD.decode(encoded).unwrap();
let text = String::from_utf8(decoded).unwrap();
println!("{}", text); // Résultat: "Hello, world!"

Add to Cargo.toml:

[dependencies]
base64 = "0.21"

These functions make it easy to handle encoding and decoding directly in your code, enabling smooth data processing and transmission in web applications and on the backend.

topics covered

related reading