RevealTheme logo

画像→Base64変換ツール

任意の画像ファイルをBase64のデータURLに変換します。結果をCSS、HTML、JSONに直接貼り付けられます。

このツールの使い方

  1. 1

    Click the file picker and choose an image (PNG, JPEG, GIF, WebP, SVG, or any format your browser accepts).

  2. 2

    Wait a moment while the browser reads the file and renders a preview thumbnail.

  3. 3

    Review the generated data URL in the text box below the preview.

  4. 4

    Click Copy to put the full data URL on your clipboard, then paste it into your stylesheet or markup.

画像→Base64変換ツールとは何ですか?

Base64のデータURLは、画像のバイナリ内容をHTMLやCSSに直接埋め込みます。これにより、小さなアイコンやグラフィックに対するHTTPリクエストがなくなり、体感的な読み込み時間を改善できることがあります。ただし、トレードオフとして、Base64エンコードはファイルサイズを約33%増加させるため、5KB未満のアイコンに最適です。

よくある活用例

  • Inline a small icon directly in a CSS background-image: url(...) rule to save an HTTP request.

  • Embed a logo in a single self-contained HTML email or offline page with no external files.

  • Paste image data into a JSON payload or API request that only accepts text fields.

  • Store a tiny placeholder image as a string in a config file or environment variable.

  • Drop an avatar or sprite straight into a React or Vue component without a separate asset import.

  • Generate a quick data URL to test how a graphic renders in a sandbox or CodePen snippet.

よくある質問

Base64画像はいつ使うべきですか?
HTTPリクエストを1つ減らしたい、小さなアイコン、ロゴ、スプライトに適しています。大きな画像には避けてください。エンコードによるオーバーヘッドがメリットを打ち消してしまいます。
これをCSSで使えますか?
はい。データURLをbackground-image: url(...)の宣言に直接貼り付けてください。

関連ツール