Convert to AVIF
AVIF routinely produces the smallest file of any mainstream image format for a given picture, which matters once a site is serving that image thousands of times a day. This endpoint takes a JPEG or PNG and converts it to AVIF automatically, so the format's savings show up on a whole library without anyone re-exporting images 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 AVIF earns the extra step
Image formats trade off compression efficiency against how widely they're supported, and for most of the web's history that trade-off favored older, less efficient formats simply because everything could open them. AVIF breaks that pattern: it inherits the compression techniques of a modern video codec, which is why it consistently beats JPEG and often beats WebP on file size for the same visual quality, and browser support has caught up enough that it's now a practical default rather than an experiment.
Who benefits from converting to AVIF
High-traffic sites where image bandwidth is a real line item, not a rounding error; photo-heavy platforms serving galleries where every kilobyte saved multiplies across millions of views; teams that already converted their JPEGs to WebP once and are now moving to the next format down in size. Anywhere image weight is measured in aggregate rather than per file, AVIF is where the next real savings sit.
What happens to your image
You post a JPEG or PNG file, we return a task_id right away, and the job re-encodes it as AVIF, preserving transparency when the source has it. Once it's ready you're notified by signed webhook, or you fetch the AVIF file from a signed link valid for 24 hours.
Fitting it into an image pipeline
Because it's async and billed only on success, converting to AVIF works the same whether it's a single hero image or a full library: submit each file, receive its own task_id, and let webhooks return finished AVIF files as they're ready, with failed conversions retried automatically up to three times and never charged, even at the scale of a full catalog.
A brief history of the format
AVIF is built on the AV1 video codec, an open, royalty-free format finalized in 2018 by a coalition of browser and hardware makers looking for a successor to older video compression. Applying that same codec to still images produced AVIF, standardized shortly after, and it now sits alongside WebP as one of the two formats actually built for how images are compressed and served on the modern web rather than inherited from decades-old defaults.
What you can do with it
High-traffic image delivery
A media site converts its most-viewed images to AVIF to cut bandwidth on the pages that get the largest share of traffic.
Photo gallery platforms
A photo-sharing service converts uploaded JPEGs to AVIF so galleries with thousands of images load noticeably lighter.
Next step after WebP
A site that already converted its library to WebP runs a second pass to AVIF to squeeze out additional savings on the same images.
Mobile-first storefronts
An online store converts product photos to AVIF specifically to reduce data usage for shoppers browsing on mobile connections.
FAQ
Is the Image to AVIF API available now?
Yes, it's live at POST /image/to-avif with the pricing below already in effect.
How is it priced?
$0.002 per request plus $0.005 per image, published and the same whether you convert one image or a hundred thousand.
What source formats can I convert from?
JPEG and PNG are both supported as input, converted to AVIF as the output format.
Is AVIF actually smaller than WebP?
It commonly is, though the exact difference depends on the image; AVIF is generally the more space-efficient of the two modern formats.
Does transparency carry over?
Yes, AVIF supports transparency, and it's preserved when converting from a PNG source that has it.
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 AVIF file?
By signed webhook when the conversion is done, or via a signed link that stays valid for 24 hours.
Am I charged if a conversion fails?
No. Failed tasks retry automatically up to three times and are never billed; you get a clear error instead.
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-avif \
-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-avif", {
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-avif",
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-avif", 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-avif", 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_avif",
"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. |