UltraConvert
الترميز

Base64 Encoder & Decoder

Convert between plain text and Base64 encoding instantly. Base64 is the standard encoding for transmitting binary data over text-based protocols. This tool properly handles UTF-8 text and offers an optional URL-safe alphabet variant perfect for JWTs, API tokens, and query string parameters.

ماذا تفعل هذه الأداة؟

The Base64 tool provides bidirectional encoding and decoding between text and Base64 representation. It properly encodes text via UTF-8 to handle any Unicode characters including emoji, accented characters, and non-Latin scripts. The URL-safe variant follows RFC 4648 Section 5, replacing '+' and '/' with '-' and '_' and omitting padding '=' characters — essential for embedding in URLs without additional percent-encoding. The decoder validates input and provides helpful error messages for malformed Base64.

كيف تعمل

Encoding uses the browser's TextEncoder to convert text to UTF-8 bytes, then applies the Base64 algorithm to produce the ASCII representation. For URL-safe mode, standard output characters are substituted: '+' becomes '-', '/' becomes '_', and trailing '=' padding is removed. Decoding reverses the process: URL-safe characters are mapped back to standard Base64 alphabet, padding is restored if needed, Base64 decoding produces bytes, and TextDecoder converts UTF-8 bytes back to text. Invalid characters or improper padding trigger clear error messages.

الميزات

كيفية الاستخدام

  1. 1

    Select encode or decode mode

    Choose Encode to convert text → Base64, or Decode to convert Base64 → text.

  2. 2

    Enter your input

    Type or paste text to encode, or paste Base64 to decode. The output updates automatically as you type.

  3. 3

    Toggle URL-safe mode (encoding)

    Enable URL-safe for tokens, JWTs, or query parameters. This uses '-' and '_' instead of '+' and '/' and omits padding.

  4. 4

    Copy the result

    Click the copy button on the output field to copy the encoded or decoded result to your clipboard.

حالات الاستخدام الشائعة

API token handling

Decode JWT segments, encode API credentials, or prepare authentication tokens for HTTP headers.

Data URL creation

Encode small images or files to Base64 data URLs for embedding directly in HTML, CSS, or JSON.

Email attachment encoding

Base64 is the standard encoding for MIME email attachments — understand or debug email content.

URL parameter encoding

Use URL-safe Base64 to embed binary data in query strings without triggering percent-encoding issues.

نصائح وأفضل الممارسات

الأسئلة المتكررة

Why use URL-safe Base64?
Standard Base64 uses + and /, which have special meaning in URLs and require percent-encoding. URL-safe swaps those for - and _, and drops trailing = padding. Used by JWTs and most modern APIs to avoid URL encoding issues.
Does it handle Unicode correctly?
Yes. Text is encoded via TextEncoder (UTF-8) so emoji, accented characters, CJK text, and all Unicode round-trip correctly through encode/decode cycles.
Why does my decoded text look wrong?
Most commonly: (1) Input was URL-safe but you didn't enable URL-safe mode, (2) Text was not UTF-8 encoded originally, (3) Binary data was encoded and you're trying to read as text.
Is Base64 encryption?
No — Base64 is encoding, not encryption. It provides zero security; anyone can decode it instantly. It only makes binary data safe for text transport. For encryption, use our AES tool.

أدوات ذات صلة