Stax
Tools

Base64 เข้ารหัส / ถอดรหัส

เข้ารหัสข้อความเป็น Base64 หรือถอดรหัสกลับเป็นข้อความธรรมดา

Base64 คืออะไรและเมื่อใดที่ใช้?

วิธีเข้ารหัสและถอดรหัส

Base64 มาตรฐาน เทียบกับ URL-safe Base64

Base64 เป็นรูปแบบการเข้ารหัสที่แทนข้อมูลไบนารีโดยใช้อักขระ ASCII ที่พิมพ์ได้เพียง 64 ตัว ชื่อมาจากตัวอักษร 64 ตัวที่ใช้: A–Z, a–z, 0–9, + และ / ออกแบบมาเพื่อวัตถุประสงค์เดียว: ส่งข้อมูลอย่างปลอดภัยผ่านช่องทางที่รองรับเฉพาะข้อความธรรมดา

การใช้งานจริงที่พบบ่อย ได้แก่ การฝังรูปภาพโดยตรงใน HTML หรือ CSS (data:image/png;base64,…) การเข้ารหัส payload ไบนารีใน JSON APIs การจัดเก็บไฟล์เล็กๆ ใน localStorage และการส่งข้อมูลในอีเมล (การเข้ารหัส MIME)

Base64 มาตรฐานใช้ + และ / ซึ่งมีความหมายพิเศษใน URL URL-safe Base64 แทนที่ด้วย - และ _ และละเว้น padding คุณจะพบ URL-safe Base64 ใน JWT, OAuth tokens และพารามิเตอร์ API บางตัว

  1. ในการเข้ารหัส: วางข้อความธรรมดาในช่องป้อนข้อมูลและคลิก Encode → สตริง Base64 จะปรากฏในเอาต์พุต
  2. ในการถอดรหัส: วางสตริง Base64 ในช่องป้อนข้อมูลและคลิก ← Decode ข้อความต้นฉบับจะปรากฏในเอาต์พุต
  3. ใช้ Swap ⇅ เพื่อย้ายเอาต์พุตกลับไปยังอินพุตสำหรับการดำเนินการแบบลูกโซ่

คำถามที่พบบ่อย

What is Base64 encoding?
Base64 converts binary data (or any text) into a string of 64 safe ASCII characters (A–Z, a–z, 0–9, +, /). It's used to safely transmit data in contexts that only support text — like embedding images in HTML, sending binary data in JSON, or storing data in cookies.
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. It's fully reversible by anyone who sees it — there's no key, no secret, no security. Never use Base64 to protect sensitive data. Use it only to encode data so it survives text-only transport.
Does this tool support Unicode and emoji?
Yes. The encoder uses encodeURIComponent + unescape internally to handle the full Unicode range before passing to btoa(), so characters like ₹, 中文, and emoji all encode and decode correctly.
Is my data sent to a server?
No. Encoding and decoding happen in your browser using JavaScript's built-in btoa() and atob() functions. Nothing is uploaded or logged.
What's the = sign at the end of Base64?
Base64 encodes 3 bytes at a time into 4 characters. If the input isn't a multiple of 3 bytes, padding characters (=) are added to make the output length a multiple of 4. One = means 1 padding byte; == means 2.

เครื่องมือที่เกี่ยวข้อง