从 Base64 格式解码


将你的文本粘贴到下面的字段中
字符集
拖放文件或点击 + 上传
字符集
Base64 decode

上传或拖放文件到此处

Base64 Decode
拖放文件或点击 + 上传
所有标有星号(*)的字段不能为空。
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Base64 Decode Base64 Decode Base64 Decode

Base64 编码

Base64 编码是一种将二进制数据(如图像、文件或纯文本)转换为 ASCII 字符串格式的方法。它通常用于网页开发、电子邮件格式和仅允许文本安全字符的数据传输中。通过将数据转换为 base-64 表示,可以确保其在不支持二进制格式的系统中传输时保持不变。

编码为 Base64 格式

Base64 编码器允许你上传并转换文件(如图像、PDF 或文档)为 Base64 格式,使用我们的在线工具。Base64 编码在将电子邮件附件、网页资源和加密数据直接嵌入 HTML、CSS 或 JSON 中时特别有用。

确保准确性与高效性

无论你是为了开发、存储还是安全目的而需要将文件编码为 Base64,本工具都可确保准确性和高效性。

如何使用此 Base64 编码工具

Paste your text within the field below
Character Set
Drag and drop the file or click + to upload
Character Set
Base64 decode

Upload or drag
and drop file here

Base64 Decode
Drop Files or Click the + above to add Files.
All fields marked with an asterisk (*) cannot be left blank.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
1
 编码为 Base64 格式
复制并粘贴你的原始字符串或拖放一个文件。
2
更改编码类型
调整编码格式和换行符。
3
点击这里进行编码
点击“编码”以将数据转换为原始格式。
4
 复制输出结果
在此获取你的编码结果。
Base64 Decode Base64 DecodeBase64 Decode

Base64 的常见用例

Base64 Decode
电子邮件附件
MIME 格式)——电子邮件系统将文件编码为 Base64 以确保正确的传输和显示。这种方法使数据在通过传统不支持 8 位传输的电子邮件系统中传输时不易被修改。网页开发者使用 Base64 编码将图像和媒体直接嵌入到 HTML 或 CSS 文件中。
Base64 Decode
 加密应用
Base64 编码方案有助于将哈希密码、数字签名和安全密钥以 Base64 格式存储。它也用于安全文件传输。许多系统在传输前将敏感文件编码为 Base64,以保持其完整性。
Base64 Decode
编码数据保持完整
URL 安全编码会将 + 转换为 -,/ 转换为 _,以防止 URL 中出现问题。同时,空格和特殊字符将编码为 %20,以增强在网络链接中的兼容性。它还确保编码数据在链接、API 和其他基于网络的环境中保持完整。
Base64 Decode
可打印字符
Base64 使用一组可打印字符来表示二进制数据,但在网页开发中,一些字符需要特殊处理。标准字符包括:前 62 个使用 A-Z、a-z、0-9,另外使用 + 和 / 进行编码。

Base64 编码函数

Base64 编码在大多数编程语言中都原生支持或通过库实现。下面是它的典型实现方式:

JavaScript
// JavaScript

//The atob() function encode strings to Base64 in web applications.

const encodedString = atob("Some encoded string");
console.log(encodedString); // Output: U29tZSBlbmNvZGVkIHN0cmluZw==
Base64 Decode
# Python
# The base64.b64decode() function converts Base64 text into its original binary format.
import base64
original_str = "Some encoded string"
encoded_bytes= base64.b64encode(original_str.encode("utf-8"))
print(encoded_str)  # Output: U29tZSBlbmNvZGVkIHN0cmluZw==
Base64 Decode
// PHP
// The base64_decode() function allows web developers to process encoded data.
$encoded_str = "U29tZSBlbmNvZGVkIHN0cmluZw==";
$decoded_str = base64_decode($encoded_str);
echo $decoded_str; // Output: Some encoded string
Base64 Decode
// Java
// The Base64.getEncoder().encodeToString() method efficiently encodes text into Base64.
import java.util.Base64;
public class Main {
    public static void main(String[] args) {
        String originalStr = "Some encoded string";
        String encodedStr = Base64.getEncoder().encodeToString(originalStr.getBytes());
        System.out.println(encodedStr); // Output: U29tZSBlbmNvZGVkIHN0cmluZw==
    }
}
Base64 Decode
// C#
// The Convert.ToBase64String() method encodes binary data into a Base64 string.
using System;
class Program{
   static void Main()
   {
       string original = "string"; // Original string to encode
       byte[] bytes = System.Text.Encoding.UTF8.GetBytes(original); // Convert string to bytes
       string encoded = Convert.ToBase64String(bytes); // Encode bytes to Base64
       Console.WriteLine(encoded); // Output: c3RyaW5n
   }
}
Base64 Decode
# Ruby
# The Base64.encode64() method encodes a string into Base64 format.
require 'base64'original = 'string'  # Original string to encode
encoded = Base64.encode64(original)  # Encode string to Base64
puts encoded  # Output: c3RyaW5n
Base64 Decode
-- MySQL
-- The TO_BASE64() function encodes a string into Base64 format.
SELECT TO_BASE64('string') AS encoded; -- Output: c3RyaW5n
Base64 Decode
-- PostgreSQL
-- The encode() function encodes binary data using the specified format, like 'base64'.
SELECT encode('string'::bytea, 'base64') AS encoded; -- Output: c3RyaW5n
Base64 Decode
# Linux CLI
# The base64 command encodes input into Base64 format.
# The -n flag prevents echo from adding a newline character.
echo -n 'string' | base64  # Output: c3RyaW5n
Base64 Decode
Base64 Decode Base64 DecodeBase64 Decode