Chuyển đổi Base64 thành Văn bản trực tuyến bằng công cụ giải mã Base64 miễn phí của chúng tôi. Base64 to Text Converter dịch ngay Base64 sang Văn bản và ngược lại.
Ví dụ: dGVzdA== đến 'thử nghiệm'
Here is an example of how to encode and decode Base64 in Python, PHP, Java, NodeJS and C++:
import base64
# Encoding
data = b'hello world'
encoded_data = base64.b64encode(data)
print(encoded_data)
# Decoding
decoded_data = base64.b64decode(encoded_data)
print(decoded_data)
⁄⁄ Encoding
$data = 'hello world';
$encoded_data = base64_encode($data);
echo $encoded_data;
⁄⁄ Decoding
$decoded_data = base64_decode($encoded_data);
echo $decoded_data;
import java.util.Base64;
⁄⁄ Encoding
byte[] data = "hello world".getBytes("UTF-8");
String encodedData = Base64.getEncoder().encodeToString(data);
System.out.println(encodedData);
⁄⁄ Decoding
byte[] decodedData = Base64.getDecoder().decode(encodedData);
String decodedString = new String(decodedData, "UTF-8");
System.out.println(decodedString);
const base64 = require('base64-js');
⁄⁄ Encoding
const data = Buffer.from('hello world');
const encodedData = base64.fromByteArray(data);
console.log(encodedData);
⁄⁄ Decoding
const decodedData = base64.toByteArray(encodedData);
console.log(decodedData.toString());
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include "base64.h"
using namespace std;
⁄⁄ Encoding
string data = "hello world";
string encoded_data = base64_encode(reinterpret_cast<const unsigned char*>(data.c_str()), data.length());
cout << encoded_data << endl;
⁄⁄ Decoding
string decoded_data = base64_decode(encoded_data);
cout << decoded_data << endl;
Unlock your monthly dose of new productivity tools by subscribing to our newsletter