{
  "id": 16852268,
  "title": "Base64 Encode and Decode Without Breaking Emoji and Non-English Text",
  "url": "https://urgent.news/2026/10/28/base64-encode-and-decode-without-breaking-emoji-and-non-english-text",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-28T05:23:05.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sujalkhatri/base64-encode-and-decode-without-breaking-emoji-and-non-english-text-24nj"
  },
  "original_language": "en",
  "account": "Base64 encoding and decoding are methods to represent bytes as text characters, allowing them to be safely used in text-based systems like URLs, JSON, emails, and config files. The encoding process converts every 3 bytes into 4 characters, making the output about 33% larger than the input.\n\nHowever, commonly used functions btoa() and atob() in browsers only handle Latin-1 characters. When these functions encounter emoji or non-English text, they either throw an error or corrupt the result. To avoid this issue, it is recommended to first encode the text as UTF-8, then Base64-encode the resulting bytes.\n\nIn modern JavaScript, you can safely encode and decode Unicode text using the following code snippets:\n1. Encoding: Create a TextEncoder object, encode the string \"Hello 🌍\", convert the resulting bytes to a binary string, and then Base64-encode the binary string. The encoded result will be \"SGVsbG8g8J+MjQ=\".\n2. Decoding: Base64-decode the encoded string, convert the resulting binary string to an array of bytes, and then decode those bytes using a TextDecoder. The decoded result will be \"Hello 🌍\".\n\nFor quick encoding or decoding, you can use an online tool that processes text in your browser without installing anything. This tool checks for invalid Base64 input, providing clear errors instead of garbled output. It's essential to note that Base64 is not encryption and should not be used to protect passwords or secrets. It's primarily used for transport and compatibility, not security. BulkTextKit Pro offers a one-time payment option for bulk processing of up to 50 texts at once, along with saved presets and CSV export. The base tool remains free.",
  "summary": "You have probably met Base64 in the wild: an API token, a data URI in an image tag, a long string pasted into a config file, or an email attachment. It looks like random letters, numbers, + and /, often ending in =. Base64 is not magic. It is a way to represent any bytes as plain, safe text characters so they survive places that only handle text — URLs, JSON, emails, config files. Every 3 bytes…",
  "key_points": [
    "Encode UTF-8 bytes before Base64 encoding to handle emoji and non-English text",
    "Decode by reversing: Base64-decode, convert binary to bytes, then decode using TextDecoder",
    "Use online tools for quick encoding/decoding, avoid using Base64 for security"
  ],
  "editors_take": "Transitioning from standard browser functions to UTF-8 encoding ensures that developers can safely transport complex Unicode characters and emojis through text-based systems without risking data corruption.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}