Base64 エンコーダー / デコーダー
テキストをBase64にエンコード、または逆にデコード。
Base64とは何か、いつ使うか?
エンコードとデコードの方法
Base64 対 URL-safe Base64
Base64は64個の印刷可能なASCII文字のみを使用してバイナリデータを表現するエンコーディング方式です。名前はA〜Z・a〜z・0〜9・+・/からなる64文字のアルファベットに由来します。設計目的はただ一つ:プレーンテキストのみをサポートするチャンネルを通じてデータを安全に送信することです。
実際の主な用途には:HTMLやCSS内への画像の直接埋め込み(data:image/png;base64,...)、JSON APIでのバイナリペイロードのエンコード、localStorageへの小さなファイルの保存、メールでのデータ送信(MIMEエンコード)などがあります。
標準のBase64は+と/を使いますが、これらはURLで特別な意味を持ちます。URL-safe Base64はそれらを-と_に置き換え、パディングを省略します。JWT・OAuthトークン・一部のAPIパラメーターでURL-safe Base64が使われています。+と/の代わりに-と_が見られる場合は、このツールでデコードする前に置き換えてください。
- エンコードするには:入力欄にプレーンテキストを貼り付けてEncode →をクリックします。Base64文字列が出力に表示されます。
- デコードするには:入力欄にBase64文字列を貼り付けて← Decodeをクリックします。元のテキストが出力に表示されます。
- Swap ⇅を使うと、出力を入力に戻して操作を連鎖できます。
よくある質問
- What is Base64 encoding?
- Base64 converts binary data (or any text) into a string of 64 safe ASCII characters (A–Z, a–z, 0–9, +, /). It's used to safely transmit data in contexts that only support text — like embedding images in HTML, sending binary data in JSON, or storing data in cookies.
- Is Base64 the same as encryption?
- No. Base64 is encoding, not encryption. It's fully reversible by anyone who sees it — there's no key, no secret, no security. Never use Base64 to protect sensitive data. Use it only to encode data so it survives text-only transport.
- Does this tool support Unicode and emoji?
- Yes. The encoder uses encodeURIComponent + unescape internally to handle the full Unicode range before passing to btoa(), so characters like ₹, 中文, and emoji all encode and decode correctly.
- Is my data sent to a server?
- No. Encoding and decoding happen in your browser using JavaScript's built-in btoa() and atob() functions. Nothing is uploaded or logged.
- What's the = sign at the end of Base64?
- Base64 encodes 3 bytes at a time into 4 characters. If the input isn't a multiple of 3 bytes, padding characters (=) are added to make the output length a multiple of 4. One = means 1 padding byte; == means 2.
関連ツール
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- QRコード生成
URL、テキスト、Wi-FiなどのQRコードを生成。PNGでダウンロード可能。
- パスワード生成
カスタム長と文字セットで強力なランダムパスワードを生成。
- URLエンコーダー / デコーダー
パーセントエンコーディングでURLとクエリ文字列をエンコードまたはデコード。
- ハッシュ生成
SHA-1、SHA-256、SHA-384、SHA-512ハッシュを瞬時に生成。