Megapixel resolution converter
4000 × 3000 pixels make exactly 12 megapixels, and 12 megapixels are 12,000,000 pixels. Switch between megapixels, pixels, kilopixels, gigapixels and width × height, or turn a rating into frame dimensions at the aspect ratio you choose. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Value
- 12
- From
- megapixels
- To
- pixels
- Result
- 12,000,000 pixels
- Total pixels
- 12,000,000
- Megapixels
- 12
- Kilopixels
- 12,000
A megapixel resolution converter turns camera and display sensor ratings into concrete pixel counts and the other way around without spreadsheet formulas or marketing-round guesswork. Enter a positive magnitude plus a source unit among megapixels, total pixels, kilopixels, gigapixels, or pixel width by height; choose a target unit; and the tool returns the converted value, the total pixel count, the same reading on every supported scale, optional derived dimensions at a chosen aspect ratio, and step-by-step substitution lines you can paste into a brief or datasheet.
Which resolution units are supported and how conversion works
This capability converts among five everyday image-resolution representations that dominate camera marketing sheets, image pipeline configs, and classroom exercises. Megapixels are the internal marketing unit most people search for: one megapixel equals exactly one million pixels on the SI scale used by sensor vendors, not a binary mebibyte-style power of two. Total pixels are the raw width times height count that image buffers and codec settings actually allocate.
Kilopixels express the same total divided by one thousand for compact dashboards; gigapixels express total divided by one billion for large mosaic and astronomy-class rasters. Dimensions mean a width and height pair in pixels whose product is the total pixel count. Conversion always goes through that total-pixel hub: the input is turned into total pixels with an exact factor, then scaled into the target unit.
Same-unit scalar requests succeed and return the input magnitude with a short message that no change of unit was required.
Practical tips, limits, and when to use this landing
Prefer sending bare numbers for value, width, and height when you control the client; string numbers are accepted only when they match a strict finite numeric pattern without currency symbols or thousand separators. Round-trip checks are straightforward: convert A to B and B back to A and confirm you recover the original within the published twelve-decimal rounding.
Classic teaching examples include twelve megapixels to twelve million pixels, four thousand by three thousand pixels to twelve megapixels exactly, eight point two nine four four megapixels for a three thousand eight hundred forty by two thousand one hundred sixty Ultra HD frame, and twelve megapixels back to a sixteen-by-nine dimension pair for layout sketches. Stay inside the absolute range so intermediate totals cannot overflow.
This landing targets people searching for a megapixel converter, megapixels to pixels, camera resolution calculator, or width height to megapixels online; it is not a DPI or PPI density converter, not a print-size calculator that turns pixels into inches, and not a color-depth or bit-per-pixel tool.
What you can do with it
Camera and sensor megapixel checks
Convert marketing megapixel ratings into exact total pixels or verify that a stated width×height frame matches the claimed megapixel count.
Image pipeline configuration
Normalize mixed resolution fields in asset metadata—MP, pixel totals, and dimension pairs—into one scale for storage quotas and resize jobs.
Teaching SI mega and giga factors
Educators and students convert between kilopixels, megapixels, and gigapixels with exact 10³ / 10⁶ / 10⁹ factors and printable step lines.
FAQ
Is the megapixel converter free?
The browser tool is free and runs locally.
How many pixels are in 12 megapixels?
Exactly 12,000,000. One megapixel is one million pixels on the decimal scale camera makers use, not a binary power of two, so the converter simply multiplies by one million.
How do I work out megapixels from width and height?
Choose width × height as the starting unit and type both sides in pixels. The tool multiplies them for the total: a 4000 × 3000 frame is exactly 12 megapixels.
Can I turn a megapixel rating into a width and height?
Yes. Pick width × height as the target and set the aspect ratio, which is 16:9 unless you change it. The width comes from the square root of the total adjusted to the ratio, and the height is the total divided by that width.
Does it work out DPI or print size?
No. It only converts pixel counts and frame sizes. Density in DPI or PPI, print size in inches and color depth are different questions that need a different calculator.
Related tools
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, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/conv/megapixels \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"value":12,"to":"pixels"}'const res = await fetch("https://api.kit.forhosting.com/conv/megapixels", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": 12,
"to": "pixels"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/conv/megapixels",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"value": 12,
"to": "pixels"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/conv/megapixels", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"value":12,"to":"pixels"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"value":12,"to":"pixels"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/conv/megapixels", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"value": 12,
"to": "pixels"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "conv.megapixels",
"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.
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. |
Technical notes
Unknown unit names fail with a clear invalid_input error instead of silent wrong factors. Photographers comparing body megapixel claims to actual 4000 by 3000 frames, product teams sizing image pipelines, educators teaching SI mega factors, and API clients normalizing mixed resolution fields all need the same deterministic path.
Which resolution units are supported and how conversion works
When the target is dimensions, width and height are recovered from total pixels and an aspect ratio: width equals the square root of total times aspect width over aspect height, and height equals total divided by width, defaulting to a sixteen-by-nine frame when you omit aspect_w and aspect_h. Common aliases are accepted case-insensitively: mp, mpx, and megapixel for megapixels; px, pixel count, and total pixels for pixels; kp and kpx for kilopixels; gp and gpx for gigapixels; and wxh, width x height, and resolution for dimensions. If the name is not on that list the solver rejects the request with invalid_input naming the bad field and listing supported units, so clients never guess whether a typo produced a wrong number. Zero and negative values are rejected because pixel counts and megapixel ratings are not signed quantities; absolute magnitude must stay within the published one-trillion limit so intermediate products remain finite in IEEE double precision on the Worker and in the browser.
How to call the API and read the response
Value, width, height, and aspect parts must be finite positive numbers or strict numeric strings within absolute limits of one trillion. Wire this into camera comparison tools, media asset pipelines, education worksheets, or batch jobs that already hold a resolution reading and only need a second representation for display or storage without shipping conversion tables in every app binary. Send a JSON body with a target unit in to (aliases to_unit, unit_to, and target) and either a scalar reading or a width by height pair. For scalar mode provide value (aliases amount, quantity, n, and mp) and optionally from (aliases from_unit, unit_from, and source); when from is omitted and value is present the source defaults to megapixels. For dimension mode provide positive width and height (aliases width_px, w, w_px and height_px, h, h_px); from may be set to dimensions or omitted. When to is dimensions, optional aspect_w and aspect_h (defaults sixteen and nine) control the recovered frame shape. On success the response echoes a rounded value, canonical from and to labels, result as the primary converted magnitude, total_pixels, megapixels, kilopixels, and gigapixels for every request, unit as the target label, formula and message as English summaries, steps as ordered substitution lines, and supported_units as the five canonical identifiers. When dimensions are inputs or outputs, width, height, aspect_w, and aspect_h appear as well. Failed validation—missing fields, non-finite numbers, non-positive values, values outside absolute limits, or an unknown unit name—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item.
Practical tips, limits, and when to use this landing
Normalize display labels on your side if you need locale-specific spellings—this API always returns the short canonical tokens megapixels, pixels, kilopixels, gigapixels, and dimensions so automated tests stay stable. Prefer this capability when both endpoints are among the five supported resolution representations and you need deterministic SI factors and step strings; if you need physical print dimensions from pixel counts and DPI, use a print size calculator instead. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients deliberately probe unknown unit names.
Technical questions
Which resolution units can I convert?
megapixels, pixels (total count), kilopixels, gigapixels, and dimensions (width×height), including common aliases such as mp, mpx, px, kp, gp, and wxh.
What happens if I send an unknown unit name?
The API returns invalid_input, names the bad field, and lists the supported units. The failed task is not charged.
Is one megapixel exactly one million pixels?
Yes. This converter uses the SI marketing definition: 1 megapixel = 1 000 000 pixels, 1 kilopixel = 1 000 pixels, 1 gigapixel = 1 000 000 000 pixels.
Are results deterministic across browser and API?
Yes. Handler and shared lib.js use fixed SI factors and twelve-decimal rounding, so golden examples match production.