การเข้ารหัส
Base64
เข้ารหัสและถอดรหัส Base64 — ข้อความและไฟล์ ทำงานในเบราว์เซอร์โดยตรง
Base64 is a binary-to-text encoding that represents arbitrary bytes using 64 printable ASCII characters (A–Z, a–z, 0–9, plus + and /). It exists so binary data — images, archives, cryptographic keys — can pass unchanged through channels that were designed for text only.
This tool encodes and decodes both plain text and files. Everything runs client-side in your browser: the input never leaves your machine, which makes it safe for tokens, private keys, and other sensitive data.
How to use it
- Encode text: pick the Encode / Text mode, paste your string, and copy the Base64 result.
- Encode a file: switch to File mode and choose a file — you get its Base64 representation, ready for a data URI or JSON field.
- Decode: switch to Decode mode and paste a Base64 string; if it decodes to a known file type you can download the original file.
Common uses
- Embedding small images or fonts directly in CSS/HTML via data: URIs.
- Putting binary payloads inside JSON, XML, or form fields.
- Encoding credentials for the HTTP Basic Authorization header.
- Storing or transmitting PEM keys and certificates.
Things to keep in mind
Base64 is not encryption — anyone can decode it. It only changes the representation of data, not its confidentiality.
Encoded output is about 33% larger than the input because every 3 bytes become 4 characters.
For URLs and file names use Base64URL, which swaps + and / for - and _ and often drops the = padding.
บทความเกี่ยวกับเครื่องมือนี้: Base64: การเข้ารหัสมีไว้ทำไมและทำงานอย่างไร
คำถามที่พบบ่อย
Base64 ใช้ทำอะไรจริง ๆ?
Base64 แปลงข้อมูลไบนารีให้เป็นข้อความ ASCII ธรรมดา เพื่อให้ส่งผ่านระบบที่รองรับเฉพาะข้อความได้อย่างปลอดภัย เช่น เนื้อหาอีเมล, JSON payload หรือฝังรูปภาพขนาดเล็กลงใน CSS/HTML โดยตรง
ทำไมผลลัพธ์ที่เข้ารหัสถึงใหญ่กว่าข้อมูลที่ป้อนเข้าไป?
Base64 บรรจุข้อมูล 3 ไบต์ต่อผลลัพธ์ 4 อักขระ ผลลัพธ์จึงใหญ่กว่าต้นฉบับประมาณ 33% ซึ่งเป็นเรื่องปกติ ไม่ใช่ข้อผิดพลาด
ไฟล์หรือข้อความของฉันถูกอัปโหลดไปที่ไหนหรือไม่?
ไม่ การเข้ารหัสและถอดรหัสทำงานทั้งหมดในเบราว์เซอร์ของคุณด้วย JavaScript ไม่มีการส่งข้อมูลไปยังเซิร์ฟเวอร์ จึงใช้งานได้แม้ออฟไลน์
Base64 มาตรฐานกับ Base64URL ต่างกันอย่างไร?
ใน Base64URL สัญลักษณ์ + และ / ถูกแทนด้วย - และ _ เพื่อให้นำสตริงไปใส่ใน URL หรือชื่อไฟล์ได้อย่างปลอดภัยโดยไม่ต้องทำ percent-encoding เพิ่มเติม นี่คือรูปแบบที่ JWT ใช้
สัญลักษณ์ = ท้ายสตริงหมายถึงอะไร?
มันคือ padding ที่บอกว่าบล็อก 3 ไบต์สุดท้ายขาดไบต์ไปกี่ไบต์ ไม่จำเป็นต้องมีเสมอไป — บางระบบตั้งใจตัดมันทิ้ง