Images Videos Audio Pricing Docs View as Markdown (Agent) Get started
Human Agent
← Back to blog

Convert a Base64 image to a hosted URL

AI image models (OpenAI b64_json, Gemini), HTML5 Canvas toDataURL(), and n8n/Make nodes often hand you a giant base64 string when the next API expects an HTTPS link. Here is how to convert it in your browser or automate it in one call.

Why inline data:image URIs break in production

Embedding a base64 string directly into HTML or JSON looks convenient until you ship it:

  • Email clients strip them: Gmail and Outlook block data:image/... URIs, leaving a blank box.
  • Social & messaging APIs reject them: Open Graph og:image, Slack webhooks, Twilio MMS, WhatsApp, and Buffer all require a real HTTPS URL.
  • 33% payload bloat and zero browser caching: every response re-sends the full encoded bytes instead of letting the CDN cache a single URL.

One-off conversion in your browser (no signup)

If you just copied a base64 string from DevTools, a JSON response, or an AI playground, paste it into our free Base64 image to URL converter. It strips the data:image/...;base64, prefix (or auto-detects PNG, JPEG, WebP, GIF, AVIF, or SVG from raw base64 magic bytes), decodes locally in your browser, and returns a hosted CDN link plus Markdown and HTML tags.

Automating Base64 → URL in Node.js

When your backend or workflow receives b64_json from an image model, decode it into a Blob and POST to POST /v1/images. You get back a permanent CDN URL in data.url:

Node.js
// Convert a data:image/...;base64,... string (or raw b64_json) to a permanent CDN URL async function hostBase64Image(base64Input, filename = "generated.png") { const clean = base64Input.replace(/^data:[^;]+;base64,/, ""); const bytes = Buffer.from(clean, "base64"); const form = new FormData(); form.append("file", new Blob([bytes], { type: "image/png" }), filename); const res = await fetch("https://api.pixelvault.dev/v1/images", { method: "POST", headers: { Authorization: `Bearer ${process.env.PIXELVAULT_API_KEY}` }, body: form, }); if (!res.ok) throw new Error(`Upload failed: ${res.status}`); const json = await res.json(); return json.data.url; }

Sending Base64 directly as JSON (great for n8n & Make)

If you are inside a no-code HTTP Request node (n8n, Make, Zapier) where building multipart form data is awkward, PixelVault's batch endpoint accepts raw base64 straight inside a JSON body:

cURL
# Or send base64 directly to /v1/images/batch (no multipart encoding needed) curl -s -X POST https://api.pixelvault.dev/v1/images/batch \ -H "Authorization: Bearer $PIXELVAULT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"collection":{"type":"generation","name":"cards"},"images":[{"data":"iVBORw0KGgo...","filename":"card.png"}]}' \ | jq -r '.data.items[0].url'

Once hosted, you can also resize or convert on the fly with URL params (?w=800&fmt=webp) without regenerating the image. See our guides on hosting GPT Image 2 output and hosting images in Resend emails.

Predictable pricing — subscription or pay once

Start free with 200 MB storage and 1 GB monthly bandwidth. When your pipeline grows, Starter gives 25 GB storage and 100 GB bandwidth for $9/mo — or as a one-time prepaid pass ($10 for 30 days, $79 for 1 year) with zero auto-renew.