Convert to WebP
PNG was built for lossless screenshots and graphics, not for shipping thousands of photos to a browser efficiently. This endpoint converts a PNG into WebP, a format that typically comes out around 30% lighter for the same image, so pages carrying a library of PNGs get lighter without anyone re-exporting a single file by hand.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
Why PNG alone stops being enough
PNG does one thing very well — lossless compression with clean transparency — which made it the default for logos, icons and screenshots for over two decades. But that same losslessness makes it a heavy choice for photographic content, where a modern format can represent the same picture in far fewer bytes without the eye noticing the difference. The gap between what PNG costs in bandwidth and what WebP costs for the same image is exactly what this conversion closes.
Who needs PNG-to-WebP at scale
Sites migrating an image library built up over years of PNG uploads; e-commerce platforms whose product photos were exported as PNG by default and never revisited; CMS platforms that want to serve a modern format automatically without asking editors to re-export anything. Anywhere a backlog of PNGs is quietly slowing a site down, this is the conversion that fixes it in bulk.
What happens to your image
You post the PNG file, we return a task_id immediately, and the job re-encodes it as WebP, preserving transparency where the source has it. Once it's done you're notified by signed webhook, or you fetch the WebP file from a signed link valid for 24 hours.
Fitting it into a migration
Because the call is async and billed only on success, converting an entire image library is just a matter of submitting every PNG once: a site with ten thousand product images fires ten thousand requests, and webhooks return finished WebP files as each one completes, with no charge for the handful that might fail and retry before eventually returning a clear error instead.
A brief history of the format gap
PNG was standardized in 1996 as a royalty-free alternative to GIF, built around lossless compression that made it ideal for anything with sharp edges or transparency. WebP arrived in 2010, designed specifically to beat both JPEG and PNG on file size for web delivery, and by now it's supported by essentially every modern browser — which is why converting existing PNG libraries has become a routine step rather than a risky one.
What you can do with it
Legacy image library migration
A site with years of PNG uploads converts its entire library to WebP in one batch, cutting overall page weight across the board.
Product photo optimization
An online store converts PNG product images exported by default from design tools into lighter WebP files before publishing.
CMS upload pipelines
A publishing platform automatically converts every PNG an editor uploads into WebP, so pages stay light without a manual export step.
Icon and logo sets
A design system converts a set of PNG icons and logos to WebP while keeping transparency intact for use across a site.
FAQ
Is the PNG to WebP API available now?
Yes, it's live at POST /image/to-webp with the pricing below already in effect.
How is it priced?
$0.002 per request plus $0.005 per image, published and unchanged regardless of how many files you convert.
How much smaller does the file get?
WebP typically comes out around 30% lighter than the equivalent PNG, though the exact reduction depends on the image content.
Does transparency survive the conversion?
Yes, WebP supports transparency the same way PNG does, and it's preserved during conversion.
Is it a free API?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
How do I get the converted file?
By signed webhook when the conversion finishes, or via a signed link that stays valid for 24 hours.
Am I charged if the conversion fails?
No. Failed tasks retry automatically up to three times and are never billed; you get a clear error instead.
Can I convert an entire image library at once?
Yes — each request converts one file and returns its own task_id, so a library of thousands is simply parallel requests collected by webhook.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/image/to-webp \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"image":"https://ejemplo.com/imagen.jpg"}'const res = await fetch("https://api.kit.forhosting.com/image/to-webp", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"image": "https://ejemplo.com/imagen.jpg"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/image/to-webp",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"image": "https://ejemplo.com/imagen.jpg"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/image/to-webp", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"image":"https://ejemplo.com/imagen.jpg"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"image":"https://ejemplo.com/imagen.jpg"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/image/to-webp", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"image": "https://ejemplo.com/imagen.jpg"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "image.to_webp",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 15 |
max_megapixels | 12 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |