ファイル → Base64
任意のファイルを data URL(Base64)テキストに変換。
ファイル → Base64とは
ファイル → Base64 ツールは、画像以外のファイル(フォント・JSON・PDF など任意)を data URL テキストに変換します。ファイル名・サイズ・MIME・Base64 長を表示し、HTML/CSS に貼れる data URL 全文を出力します。ブラウザ内で完結し、ファイルは送信されません(4MB まで)。画像専用の画像 ↔ Base64 もあります。
🔒 処理はすべてブラウザ内で完結し、データは送信されません。
このツールの前提
- 処理場所
- このページのブラウザ内(JavaScript / Canvas)
- アップロード
- なし — ファイルは端末の外に出ません
- オフライン
- ページを開いた後は通信不要
Any file, as text, locally
The file is read into an ArrayBuffer and encoded to Base64 in the page — useful for APIs that accept attachments only as a JSON string, for embedding a small binary in a config file, and for pasting a payload into an environment where file upload is blocked.
Encoding happens on the raw bytes, so the result is exact and lossless: decoding returns the identical file, verified by its original checksum. There is no interpretation of the content and therefore no charset problem, unlike text-oriented tools.
The 33% tax and where it stops you
Base64 grows the payload by roughly a third, and API gateways usually cap request bodies well below the file sizes people expect to send. A 10 MB PDF becomes about 13.4 MB of JSON, which then exceeds a 10 MB limit — so the failure appears at the transport layer, far from the encoding decision.
Memory is the second ceiling. The browser holds the file, the byte array and the encoded string at once, so peak usage is roughly three times the file size. Large files will stall or kill the tab well before any server limit is reached.
Decoding back to a file
A decoded payload must be written to a Blob with the correct MIME type and saved with the right extension; writing the text to a .txt file produces a file that cannot be opened. If the tool offers a download, check that the first bytes match the format you expect.
Watch for line wrapping and truncation on the way in. Base64 embedded in an email or copied out of a log often arrives broken at 76 characters with CRLF, or cut at a length limit with no error. A decoder that ignores whitespace handles the first; nothing recovers the second, which is why the decoded size should be compared with what the sender announced.
使い方
- 1.ファイルを選ぶ
- 2.実行して data URL を生成
- 3.全文をコピーして HTML/CSS に貼り付け
他の方法との比較
同じ変換をする方法は 3 つあります。ブラウザ内(このページ)、サーバー側の変換サービス、デスクトップアプリ。差がつくのは速度ではなく、ファイルがどこへ行くかと、無料でどこまでできるかです。
| 観点 | このツール | サーバー側の変換サービス | デスクトップアプリ |
|---|---|---|---|
| ファイルの処理場所 | このページのブラウザ内 | ベンダーのサーバー(アップロード後) | 自分の PC(アプリをインストール) |
| アカウント | 不要 | 多くの場合必要(無料枠の制限解除に登録を求める) | 不要(ライセンス認証は必要な場合あり) |
| 無料で扱えるサイズ | サイズ制限なし(回数制限もなし) | 数ファイル/時間、または 5〜10MB 程度で課金 wall | ディスクとメモリ次第 |
| 料金 | 無料。Pro は月 $9(大きいファイルと AI 機能のみ) | サブスクが一般的。おおむね月 $7〜15(2026 年 11 月時点) | 買い切り、またはサブスク |
| オフライン | 一度開けば通信不要 | 不可 | 可 |
| 20MB を処理し始めるまで | 待ち時間なし(アップロードが無い) | アップロードが支配的(10Mbps 上りで約 16 秒) | アプリの起動のみ |
| 保証できないこと | 出力は決定的です。他の実装と突き合わせて検証できます | 同じ(変換の原理は変わらない) | 同じ。ただし書式の再現はより忠実な場合がある |
サーバー側のサービスが優れている点は明確にあります。巨大なファイル、チームでの共有、変換履歴の管理、スクリプトからの自動化。逆に「1 回だけ、手元のファイルを別形式にしたい」という今回の用途では、アップロードの待ち時間と登録の手間だけが増えます。
よくある質問
どんなファイルでもいい?
はい。画像なら画像 ↔ Base64 ツールがプレビュー付きで便利ですが、こちらはフォント・JSON・PDF など任意のファイルに使えます。
サイズ上限は?
4MB までです。Base64 にすると元の約 1.33 倍の長さになる点に注意してください。
この変換で失われるもの
エンコードとハッシュは Web Crypto API または純 JavaScript 実装で行います。出力は決定的で、同じ入力からは常に同じ結果になります。他のツールと突き合わせて検証できます。