Text & Code

Base64 Text Encoder / Decoder

Encode text to Base64 and decode Base64 back to text. URL-safe mode available.

Your files stay on your device - processed locally via WebAssembly, never uploaded

🔒 All encoding and decoding happens in your browser. Nothing is sent anywhere.

Share this tool with othersHelp others discover free tools
Embed this tool on your website

Copy this code to add the Base64 Text Encoder / Decoder to your site for free. It runs entirely in your visitors' browsers - no API key, no usage limits.

<iframe src="https://optipix.art/embed/base64-text" width="100%" height="600" style="border:1px solid #e4e4e7;border-radius:8px;" title="Base64 Text Encoder / Decoder by OptiPix" loading="lazy"></iframe>
<p style="font-size:12px">Free tool by <a href="https://optipix.art/base64-text">OptiPix Base64 Text Encoder / Decoder</a></p>

❤️ Love this tool? Support our team.

No ads, no tracking, no limits. Tips keep 104 tools free for everyone.

$

Secure payment via Stripe · No account needed

About Base64 Text Encoder / Decoder

Last updated: May 2026

OptiPix Base64 文本编码器/解码器直接在您的浏览器中进行纯文本和 Base64 编码之间的转换。将任何 UTF-8 文本编码为 Base64,或将 Base64 字符串解码回可读文本。切换 URL 安全 Base64 模式,使用 - 和 _ 而不是 + 和 / 来兼容 URL 和文件名。启用实时模式,在您键入时进行实时转换。查看输入/输出大小统计信息,显示编码开销。拖放任何文件以将其字节编码为 Base64 字符串,或粘贴 Base64 字符串以解码并下载为文件。此工具处理文本和任意文件 - 对于带有预览和 CSS 输出的特定于图像的 Base64,请参阅图像到 Base64 工具。所有处理都在您的浏览器本地进行。

How It Works

该工具使用 JavaScript 的 btoa() 和 atob() 函数处理 ASCII 范围内的文本。为了获得完整的 UTF-8 支持,它首先使用 TextEncoder 编码文本,然后将字节数组转换为 Base64 字符串。URL 安全模式会将输出中的 + 替换为 -,将 / 替换为 _。

Use Cases

  • 将 API 密钥和令牌编码到配置文件中
  • 解码来自 API 和 JWT 的 Base64 编码数据
  • 将文件转换为 Base64 以嵌入 JSON 载荷中
  • 准备用于电子邮件 MIME 编码的数据
  • 在 Web 应用程序中调试 Base64 编码的字符串

You Might Also Like

If you find Base64 Text Encoder / Decoder useful, check out these related tools: URL Encoder / Decoder, Text to Binary / Hex / Octal, and Hash Generator. All tools run entirely in your browser with no uploads or signups required.

Frequently Asked Questions

什么是 Base64 编码?
Base64 是一种二进制到文本的编码,它使用 64 个 ASCII 字符(A-Z、a-z、0-9、+、/)来表示二进制数据。它会增加大约 33% 的大小,但能使二进制数据在电子邮件、JSON 和 URL 等基于文本的系统中安全传输。
什么是 URL 安全 Base64?
URL 安全 Base64 用 - 替换 +,用 _ 替换 /,以避免与 URL 保留字符冲突。此变体用于 JWT、数据 URI 和 URL 参数。
我可以编码文件,而不仅仅是文本吗?
是的。将任何文件拖放到该工具中,它将把原始字节编码为 Base64。您也可以粘贴 Base64 字符串并将其解码后的字节下载为文件。
这与图像到 Base64 工具有什么不同?
此工具通用处理任何文本或文件。图像到 Base64 工具专门用于图像,并提供预览、数据 URI、HTML 和 CSS 输出。
我的数据会发送到任何服务器吗?
不会。所有编码和解码都使用浏览器内置的 btoa/atob 函数,完全在您的设备上运行。

Related Tools

More Text & Code Tools

All 102 Tools

Image CompressorBackground RemoverVideo CompressorImage UpscalerOCR Text ExtractorFormat ConverterImage ResizerEXIF RemoverFace BlurDepth EstimationQR Code GeneratorWatermark MakerColor Palette ExtractorPhoto FiltersImage to PDFObject DetectionImage ClassifierImage CaptionerAI Image GeneratorMeme GeneratorGIF MakerPhoto Collage MakerImage CropPhoto EffectsImage to SVGColor ChangerNoise RemoverPhoto RestorationColor PickerFavicon GeneratorImage to Base64Image Metadata ViewerImage AnnotatorPassport Photo MakerDocument ScannerASCII Art GeneratorImage ComparisonSprite Sheet GeneratorObject RemoverPanorama MakerWord CounterCase ConverterLorem Ipsum GeneratorUUID GeneratorUnix Timestamp ConverterText DiffURL Encoder / DecoderHTML Entity Encoder / DecoderBase64 Text Encoder / DecoderText to Binary / Hex / OctalHash GeneratorJSON Formatter / ValidatorRandom String GeneratorCSV ↔ JSON ConverterMarkdown EditorUnit ConverterPercentage CalculatorBMI CalculatorAge CalculatorTip CalculatorCSS Gradient GeneratorCSS Box Shadow GeneratorCSS Border Radius GeneratorGlassmorphism GeneratorNeumorphism GeneratorCSS Text Shadow GeneratorFlexbox PlaygroundCSS Grid GeneratorAudio TrimmerAudio ConverterAudio MergerAudio RecorderVideo to Audio ExtractorAudio Speed ChangerAudio Volume BoosterRingtone MakerVocal RemoverText to SpeechSpeech to TextAudio Noise RemoverAudio EqualizerAudio EffectsVideo TrimmerVideo MergerVideo ResizerVideo Speed ChangerVideo RotatorVideo to MP4 ConverterAdd Music to VideoMute VideoVideo LooperReverse VideoVideo ScreenshotAdd Subtitles to VideoVideo WatermarkScreen RecorderWebcam RecorderSlideshow MakerVideo FiltersCron Expression BuilderRegex TesterUnix Timestamp Converter