ข้ามไปยังเนื้อหาหลัก
FreeOnlineTools Go
ไทย
how-to

วิธีเข้ารหัสและถอดรหัส Base64: คู่มือฉบับสมบูรณ์

By FreeOnlineTools Team · Updated 2026-08-27

Quick Answer

การเข้ารหัส Base64 แปลงข้อมูล binary ให้เป็นข้อความด้วยอักขระที่พิมพ์ได้ 64 ตัว (A-Z, a-z, 0-9, +, /) ใช้ Base64 Encoder ฟรีของเราเพื่อเข้ารหัส และ Base64 Decoder เพื่อถอดรหัส การประมวลผลทั้งหมดเกิดในเบราว์เซอร์ —ไม่มีข้อมูลถูกอัปโหลด

Introduction

Base64 คือรูปแบบการเข้ารหัส binary-to-text ที่แปลงข้อมูล binary ให้เป็นสตริง ASCII ใช้กันทั่วไปในการเข้ารหัสข้อมูลที่ต้องส่งผ่านสื่อที่รองรับเฉพาะข้อความ เช่น email หรือ JSON Base64 ไม่ใช่การเข้ารหัสลับ —เป็นการเข้ารหัสที่ย้อนกลับได้ ทุกคนสามารถถอดรหัสได้

Step by Step

  1. Choose your input

    Enter the text or data you want to encode into the input field of the Base64 Encoder tool. Any text content works —strings, JSON, URLs, etc.

  2. Encode to Base64

    The tool automatically encodes your input using the browser's built-in btoa() function. The result appears in the output field instantly.

  3. Copy or use the result

    Click the Copy button to copy the Base64-encoded string to your clipboard. You can now use it in your application, API call, or data transfer.

  4. Decode back to original

    To decode, paste the Base64 string into the Base64 Decoder tool. The original text appears instantly. Use the Copy button to copy the decoded result.

Examples

Encode plain text

Input: Hello, World!

Output: SGVsbG8sIFdvcmxkIQ==

Encode JSON data

Input: {"name":"FreeOnlineTools","free":true}

Output: eyJuYW1lIjoiRmlyZVRvb2xzIiwiZnJlZSI6dHJ1ZX0=

Decode Base64

Input: SGVsbG8gV29ybGQ=

Output: Hello World

Common Problems

  • Non-ASCII characters may produce unexpected results —use encodeURIComponent() before encoding if your text contains Unicode characters.
  • Base64 encoding increases data size by approximately 33% —a 3-byte input becomes 4 Base64 characters.
  • Padding (= or ==) at the end is part of the encoding and should not be removed.
  • Base64 is not encryption —anyone can decode it. Never use it to store sensitive data like passwords.

Tips

  • Use Base64 for data URLs, email attachments, and embedding images in HTML/CSS.
  • For Unicode text, use TextEncoder + btoa(unescape(encodeURIComponent(text))) in JavaScript.
  • Always validate decoded output before using it in your application.
  • Use our Base64 Encoder and Decoder tools for instant, private encoding/decoding in your browser.

Related Tools

Related Guides

References