Rotate an image
A photo taken sideways, a scan that came out upside down, a batch of uploads where half the phones recorded orientation differently than the other half — this endpoint fixes it by rotating the image to whatever angle you specify, or by reading the file's own orientation data and correcting it automatically.
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 images end up rotated wrong
Most phone cameras don't actually rotate the pixels when you turn the phone sideways to shoot; instead, they write an orientation flag into the image's EXIF metadata and expect the viewer to read it and rotate on display. That works fine in apps that respect EXIF, and fails badly in the many pipelines, thumbnail generators and older systems that ignore it, which is how a sideways photo ends up looking sideways everywhere except the phone that took it.
What the endpoint does
You send the image to /image/rotate with either a specific angle or an instruction to auto-correct based on EXIF orientation, and it returns a version with the pixels actually rotated, so the orientation is baked in and correct regardless of what the next system does or doesn't read from metadata. The request returns a task_id right away, the rotation happens asynchronously, and the result reaches you via signed webhook or a signed link valid for 24 hours.
Precision matters here
Rotation isn't only about fixing sideways photos — it also covers straightening a scanned document that went in a few degrees crooked, or turning a diagram 90 degrees to fit a layout. Arbitrary-angle rotation, not just 90/180/270 steps, means a slightly tilted scan can be corrected to sit level rather than just flipped to the nearest quarter-turn.
How it plugs into automation
Because it's a single asynchronous call, it belongs right after the upload step in any pipeline that ingests photos from unpredictable sources: user-submitted images, scanned paperwork, or camera feeds. Failed rotations retry automatically up to three times before returning a clear error, and a task that never completes is never billed, so a malformed file doesn't cost anything.
Who needs this
Document management systems correcting scanned pages, photo-sharing apps normalizing user uploads, and e-commerce platforms making sure product photos display upright regardless of how the seller's phone recorded them all lean on exactly this kind of correction.
What you can do with it
EXIF auto-correction on upload
A photo-sharing app auto-rotates every uploaded image based on its EXIF orientation flag so thumbnails never render sideways.
Scanned document straightening
A document management system rotates crooked scans by a precise angle to align text horizontally before running OCR.
Product photo normalization
An online marketplace rotates seller-submitted product photos to a consistent upright orientation before publishing listings.
Batch fix for legacy archives
An organization digitizing an old photo archive rotates a batch of scans that were fed into the scanner at inconsistent angles.
FAQ
Can the rotate image API auto-correct orientation automatically?
Yes, it can read the image's EXIF orientation data and rotate the pixels to match, so the file displays correctly everywhere, not just in EXIF-aware viewers.
Can I rotate by a custom angle, not just 90 degrees?
Yes, you can specify any angle, which is useful for straightening a slightly crooked scan rather than only rotating in quarter turns.
Is rotating images free?
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.
What's the cost per image?
$0.002 per request plus $0.005 per image, and you're never charged for a task that fails.
Is rotation synchronous?
No, it's asynchronous. You receive a task_id immediately, and the rotated image arrives via signed webhook or a signed link valid for 24 hours.
Does rotating an image lose quality?
Rotation by 90-degree increments is lossless for the pixel data; arbitrary angles involve some resampling at the edges, which is standard for any non-orthogonal rotation.
What formats can I rotate?
The endpoint works with standard raster formats like JPG, PNG, BMP, TIFF and WebP.
Can I rotate many images in one workflow?
You send one image per request, but you can fire off many requests in parallel or script it into a batch job for large volumes.
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/rotate \
-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/rotate", {
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/rotate",
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/rotate", 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/rotate", 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.rotate",
"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. |