Ücretsiz Base64 Kod Çözücü Online
Base64 kodlu dizeleri orijinal metin veya veriye geri çözün.
Base64 Kod Çözme Nedir?
Base64 kod çözme, Base64 kodlamanın tersi işlemidir. Base64 kodlu ASCII metnini orijinal ikili veya metin formatına geri dönüştürür. Bu kod çözücü aracı, programlama bilgisi gerektirmeden Base64 dizelerini hızla çözmenize yardımcı olur.
Common Uses of Base64 Decoding
- JWT Token Inspection: JSON Web Tokens (JWT) consist of three Base64URL-encoded sections separated by dots: header.payload.signature. Decoding the header reveals the token type and signing algorithm (HS256, RS256, etc.). Decoding the payload exposes claims like user ID (sub), expiration time (exp), issuer (iss), and custom data. This is invaluable for debugging authentication issues, verifying token contents during development, and understanding what information your application is storing in tokens.
- API Response Processing: Many REST APIs return binary data (images, PDFs, encrypted payloads) as Base64 strings within JSON responses. Since JSON is a text format, binary data must be encoded. When consuming these APIs, you need to decode the Base64 string to get the actual file or data. Examples include image generation APIs, document conversion services, and encrypted data transmission endpoints.
- Extracting Data URI Content: Data URIs in HTML/CSS (e.g., data:image/png;base64,iVBORw0KG...) embed files directly in code using Base64. To extract the actual file from a data URI, you decode the Base64 portion. This is useful when scraping web pages, analyzing HTML emails, or converting embedded images back to standalone files for optimization or modification.
- Email Attachment Decoding: MIME-encoded emails use Base64 for attachments. Email clients automatically decode these, but if you're writing email processing scripts, building a custom email client, or analyzing raw email source code (viewing .eml files), you'll need to decode Base64 sections manually to access the actual attachment files.
Base64 Kod Çözme Nasıl Çalışır?
Base64 kod çözme, kodlama sürecini tersine çevirerek 4 karakterlik Base64 gruplarını 3 bayt ikili veriye geri dönüştürür. Kod çözücü her karakteri 6 bit değeriyle eşleştirir, 24 bit blokları birleştirir ve bunları orijinal 8 bit baytlara böler. İşte teknik süreç:
- Adım 1 - Karakterleri değerlerle eşleştirme: Her Base64 karakteri, Base64 alfabesi kullanılarak 6 bit değerine dönüştürülür (A=0, B=1, ..., Z=25, a=26, ..., z=51, 0=52, ..., 9=61, +=62, /=63).
- Adım 2 - 6 bit gruplarını birleştirme: Her dört 6 bit değer (toplam 24 bit) tek bir 24 bit bloğa birleştirilir.
- Adım 3 - Baytlara bölme: Her 24 bit blok üç 8 bit bayta bölünerek orijinal ikili veriyi üretir.
- Adım 4 - Dolguyu işleme: Sonunda = karakterleri eksik baytları gösterir. Bir = son bloğun 2 bayt ürettiği anlamına gelir; iki = 1 bayt ürettiği anlamına gelir.
Örnek: Base64 dizesi "Y2F0" "cat" olarak çözülür. Y(24) 2(54) F(5) 0(52) 6 bit değerleri 011000 110110 000101 110100 olur, bunlar 24 bite birleştirilir ve baytlara bölünür: 01100011(99=c) 01100001(97=a) 01110100(116=t).
Understanding the Decoding Process
Base64 kodlama, e-posta eklerini kodlamanın bir yolu olarak 1996'da RFC 2045 (MIME) ile ortaya çıktı. Base64'ten önce, e-posta ile dosya göndermek sorunluydu çünkü e-posta protokolleri 7-bit ASCII metni için tasarlanmıştı. Bugün Base64, RFC 4648 tarafından tanımlanır ve e-postanın çok ötesinde web geliştirme, API'lar ve data URI'larda kullanılır.
Kod Çözme Sırasında Güvenlik Hususları
Base64 decoding is reversible and provides no security. Anyone can decode Base64 strings. Treat decoded content as untrusted unless verified. Learn about encoding security
Programlama Dillerinde Base64 Kod Çözme
Çoğu programlama dili Base64 kod çözme için yerleşik işlevler sağlar. İşte örnekler:
// Basic decoding
$decoded = base64_decode($encoded);
// Decoding with strict mode (validates input)
$decoded = base64_decode($encoded, true);
if ($decoded === false) {
// Invalid Base64 string
throw new Exception("Invalid Base64");
}
// Decoding to UTF-8 string
$text = base64_decode($encoded, true);
if (!mb_check_encoding($text, 'UTF-8')) {
// Not valid UTF-8
}
// Browser (atob for ASCII only)
try {
const decoded = atob(encoded);
} catch (e) {
console.error("Invalid Base64:", e);
}
// Browser with UTF-8 support
function base64Decode(str) {
try {
return decodeURIComponent(escape(atob(str)));
} catch (e) {
throw new Error("Invalid Base64 or UTF-8");
}
}
import base64
# Decode to bytes
try:
decoded_bytes = base64.b64decode(encoded)
decoded_text = decoded_bytes.decode('utf-8')
except Exception as e:
print(f"Decoding failed: {e}")
# Validate Base64 before decoding
try:
decoded = base64.b64decode(encoded, validate=True)
except base64.binascii.Error:
print("Invalid Base64 string")
import (
"encoding/base64"
"fmt"
)
// Standard Base64 decoding
decoded, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
fmt.Println("Decoding error:", err)
return
}
// URL-safe Base64 decoding (for JWT)
decoded, err := base64.URLEncoding.DecodeString(encoded)
if err != nil {
fmt.Println("Decoding error:", err)
}
import java.util.Base64;
import java.nio.charset.StandardCharsets;
// Basic decoding
try {
byte[] decodedBytes = Base64.getDecoder().decode(encoded);
String decoded = new String(decodedBytes, StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
System.err.println("Invalid Base64: " + e.getMessage());
}
// URL-safe decoding
byte[] decoded = Base64.getUrlDecoder().decode(encoded);
require 'base64'
# Basic decoding
begin
decoded = Base64.decode64(encoded)
rescue ArgumentError => e
puts "Invalid Base64: #{e.message}"
end
# Strict decoding (validates input)
decoded = Base64.strict_decode64(encoded)
# URL-safe decoding
decoded = Base64.urlsafe_decode64(encoded)
using System;
using System.Text;
// Basic decoding
try
{
byte[] bytes = Convert.FromBase64String(encoded);
string decoded = Encoding.UTF8.GetString(bytes);
}
catch (FormatException ex)
{
Console.WriteLine($"Invalid Base64: {ex.Message}");
}
Related Tools
Need to encode data to Base64? Use our Base64 Encoder to convert text or binary data to Base64 format.
Decoding JWT tokens? Our JWT Decoder automatically decodes all three sections and displays claims in a readable format.
Working with URL-encoded data? Try our URL Decoder to decode percent-encoded strings.