مشفر Base64
Base64 encoding converts binary data (images, files, arbitrary bytes) into ASCII text using 64 printable characters. It is essential for embedding binary data in text-based protocols: HTTP headers, email attachments (MIME), JSON payloads, and data URLs in HTML/CSS. Our tool handles text-to-Base64, file-to-Base64, URL-safe Base64, and data URL generation.
إدخال نص
المخرجات
What is Base64?
Base64 is a encoding scheme that converts binary data into ASCII text format. It uses 64 safe characters to represent data, making it ideal for transmitting data across text-only channels.
Common uses include:
- ترميز الصور كـ data URIs في HTML/CSS
- ترميز بيانات الاعتماد في HTTP Basic Auth
- نقل البيانات الثنائية عبر البريد أو APIs
- تضمين الملفات الثنائية في JSON أو XML
حول Base64 Encoder / Decoder
Base64 encoding converts binary data (images, files, arbitrary bytes) into ASCII text using 64 printable characters. It is essential for embedding binary data in text-based protocols: HTTP headers, email attachments (MIME), JSON payloads, and data URLs in HTML/CSS. Our tool handles text-to-Base64, file-to-Base64, URL-safe Base64, and data URL generation.
كيفية الاستخدام
- Enter text or paste binary data to encode to Base64.
- Paste a Base64 string to decode back to text or binary.
- Upload an image to generate a Base64 data URL (data:image/png;base64,...).
- Toggle between standard Base64 (uses + and /) and URL-safe Base64 (uses - and _).
الصيغة والمنهجية
Base64 encodes 3 bytes → 4 characters. Output size = ceil(input bytes / 3) × 4. Padding with = to make output length a multiple of 4. Character set: A–Z, a–z, 0–9, +, / (standard) or -, _ (URL-safe). Encoded size ≈ input size × 4/3 (+33%). btoa() and atob() in JavaScript; base64_encode() in PHP.
حالات الاستخدام الشائعة
- Embedding images directly in HTML/CSS without separate HTTP requests
- JWT tokens: header and payload are Base64url encoded
- API authentication: Basic Auth sends "username:password" as Base64
- Email: MIME encoding for attachments (multipart/mixed)
- Environment variables: storing binary secrets as Base64 in .env files
الأسئلة الشائعة
أدوات ذات صلة
كل الأدوات →دمج هذه الأداة في موقعك
مجاني للاستخدام الشخصي والتجاري. فقط انسخ الكود أدناه.