LocalExcelTool
はじめる

Base64 エンコード

テキストをBase64に変換。ブラウザ内で完結、サーバー送信なし。

Base64 エンコードとは

Base64エンコードとは、テキストやバイナリデータをA-Z・a-z・0-9・+・/ の64種類の文字で表現する符号化方式です。メール添付やデータURLなどで使われます。

🔒 処理はすべてブラウザ内で完結し、データは送信されません。

このツールの前提

処理場所
このページのブラウザ内(JavaScript / Canvas)
アップロード
なし — ファイルは端末の外に出ません
オフライン
ページを開いた後は通信不要

What Base64 actually does to your bytes

The text is first converted to UTF-8 bytes, then every three bytes are cut into four 6-bit groups and mapped onto the alphabet A–Z a–z 0–9 + /. When the input length is not a multiple of three, the tail is padded with one or two = signs so the output length stays a multiple of four. That is RFC 4648 section 4, and it is the only thing happening here — no compression, no encryption, no verification.

This browser API is the reason the byte step matters: btoa() accepts Latin-1 only and throws InvalidCharacterError the moment it meets a character above U+00FF. So every correct implementation converts to bytes first. A Chinese character costs three UTF-8 bytes, which become four Base64 characters; a plain ASCII letter costs one byte and lands on roughly 1.33 characters.

Where the + / = alphabet bites

Base64 output goes up by about a third, so a 3 MB file becomes a 4 MB string. If you are putting this into a URL, a filename or a JSON Web Token, the standard alphabet will be mangled: + turns into a space in a query string, / collides with path separators, and = confuses some routers. Use the URL-safe variant instead (- and _ with the padding dropped), which is what JWT does.

The other recurring mistake is treating the output as protection. Base64 is a transport encoding: anyone can decode it in one line, including anyone who intercepts it. If you need confidentiality the primitive is encryption with a key, and if you need tamper evidence it is an HMAC — not a longer alphabet.

When the output is not what a decoder expects

Line breaks are the usual culprit. Some tools wrap at 76 characters for MIME mail, others emit one unbroken line. Decoders that follow the spec ignore whitespace, but stricter ones (and many language runtimes' strict modes) reject it. If a downstream service says the Base64 is invalid while this page produced it, compare the two strings for wrapped lines before assuming corruption.

Trailing = padding is also frequently stripped by intermediaries, and while a tolerant decoder can reconstruct it, a strict one cannot. If you control both ends, keep the padding and keep the alphabet consistent — mixing standard and URL-safe Base64 across a pipeline fails silently more often than it fails loudly.

使い方

  1. 1.テキストを入力
  2. 2.「変換する」をクリック
  3. 3.結果をコピー

他の方法との比較

同じ変換をする方法は 3 つあります。ブラウザ内(このページ)、サーバー側の変換サービス、デスクトップアプリ。差がつくのは速度ではなく、ファイルがどこへ行くかと、無料でどこまでできるかです。

観点このツールサーバー側の変換サービス
ファイルの処理場所このページのブラウザ内ベンダーのサーバー(アップロード後)
アカウント不要多くの場合必要(無料枠の制限解除に登録を求める)
無料で扱えるサイズサイズ制限なし(回数制限もなし)数ファイル/時間、または 5〜10MB 程度で課金 wall
料金無料。Pro は月 $9(大きいファイルと AI 機能のみ)サブスクが一般的。おおむね月 $7〜15(2026 年 11 月時点)
オフライン一度開けば通信不要不可
20MB を処理し始めるまで待ち時間なし(アップロードが無い)アップロードが支配的(10Mbps 上りで約 16 秒)
保証できないこと出力は決定的です。他の実装と突き合わせて検証できます同じ(変換の原理は変わらない)

サーバー側のサービスが優れている点は明確にあります。巨大なファイル、チームでの共有、変換履歴の管理、スクリプトからの自動化。逆に「1 回だけ、手元のファイルを別形式にしたい」という今回の用途では、アップロードの待ち時間と登録の手間だけが増えます。

よくある質問

Base64エンコードとは何ですか?

データを64種類の文字に置き換えて表現する符号化方式です。バイナリをテキストとして扱いたいときに使います。

データはサーバーに送信されますか?

いいえ。すべてブラウザ内で処理され、入力内容が外部に送られることはありません。

日本語も変換できますか?

はい。UTF-8として正しくBase64に変換されます。

この変換で失われるもの

エンコードとハッシュは Web Crypto API または純 JavaScript 実装で行います。出力は決定的で、同じ入力からは常に同じ結果になります。他のツールと突き合わせて検証できます。

その他のエンコード / デコード