Image File Size Calculator: Bitmap, Compressed and Texture Memory

An uncompressed image is exactly as big as its arithmetic says: width times height times bits per pixel, divided by eight. This calculator computes that figure, applies a compression ratio to estimate what a JPEG, PNG or WebP encoder will actually write, reports how many images fit a card or disk of a given capacity, totals a whole shoot or asset set, and works out the video memory a texture consumes with and without a mipmap chain. It reports storage in SI megabytes of 106 bytes, which is what card and drive manufacturers use.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
WidthHorizontal pixel count of the full image, not the display size.6000 px
HeightVertical pixel count. A 6000 × 4000 frame is 24 megapixels.4000 px
ChannelsCount the samples stored per pixel. Camera raw stores one sample per photosite, not three.3 — RGB
Bits per channelPrecision of one sample. Most cameras capture 12 or 14 bits and most editors work at 8 or 16.8-bit
Compression ratioHow many times smaller the encoded file is than the bitmap. Measure it on a representative sample rather than assuming it.8 :1
Card or disk capacityUse the number printed on the card, which is decimal. A 64 GB card holds 64,000,000,000 bytes before formatting.64 bytes
Images in the setHow many frames you expect to shoot or how many assets are in the pack, for the total-storage figure.500 images
Include a full mipmap chain in texture memoryTick for a GPU texture with mipmaps, which adds exactly one third to the memory footprint.No

It returns

  • Uncompressed bitmap size — Width × height × bits per pixel ÷ 8, in megabytes of 10⁶ bytes.
  • Estimated compressed file size — The uncompressed size divided by your compression ratio. An estimate, not a measurement.
  • Bits per pixel
  • Total pixels
  • Images that fit the capacity — Whole compressed images only. Filesystem overhead and sidecar files are not counted.
  • Storage for the whole set
  • Texture memory footprint — Uncompressed pixels in video memory, multiplied by 4/3 when a mipmap chain is included.

The formula

S=whcd8
ScSr
Smip=Sk=04k=4S3

In plain text: bytes = width × height × channels × bits per channel ÷ 8

  • SUncompressed size (bytes)
  • w, hWidth and height (pixels)
  • cChannels stored per pixel (count)
  • dBits per channel (bits)
  • rCompression ratio, as r:1 (ratio)

The product c·d is the bits per pixel. Dividing by 8 converts bits to bytes; the calculator then divides by 10⁶ for megabytes, matching the decimal convention used on storage products.

Updated Category Digital Media, Display & Color Verified against published test cases Reading time 13 min

What determines the size of an image

An uncompressed image is a rectangle of numbers, and its size is completely determined by three things: how many pixels there are, how many samples are stored per pixel, and how many bits each sample uses. Multiply them and divide by eight. Everything else — file format, metadata, colour profile, thumbnail — is small by comparison and predictable.

The number people usually quote, megapixels, only captures the first of the three. A 24-megapixel frame is 72 MB as 8-bit RGB, 144 MB as 16-bit RGB, and 36 MB as a 12-bit single-channel raw. Same sensor, same scene, four-fold spread. That is why “how much does a 24 MP photo take” has no single answer until you say what is being stored.

Channels are where most mistakes happen. A camera raw file records one sample per photosite behind a colour filter array, not three: the red, green and blue values at each location are interpolated later by the demosaicing step. So a 24 MP 14-bit raw is 24,000,000 × 14 ÷ 8 = 42 MB before its own lossless compression, not the 126 MB you would get by treating it as three channels. Meanwhile a screenshot with transparency is four channels, and a print-ready CMYK file is four channels of a different kind.

Compression is the one term the arithmetic cannot give you. A JPEG or WebP encoder discards information the eye is unlikely to miss, and how much it discards depends on the quality setting and on what is in the frame. A photograph of a clear sky compresses far harder than the same camera pointed at a hedge, at identical settings. The ratio input here is your estimate, and the honest way to get it is to encode a representative sample and divide.

Working the formula, and the two conventions that trip people

Start with pixels: w × h. Then bits per pixel: channels × bits per channel. An 8-bit RGB pixel is 24 bpp, an 8-bit RGBA pixel is 32 bpp, a 16-bit RGB pixel is 48 bpp, and a 1-bit bilevel scan is 1 bpp. Multiply and divide by eight for bytes.

Convention one: which megabyte. Storage vendors, and this calculator, use SI prefixes — a megabyte is 106 bytes and a gigabyte is 109. Operating systems have historically reported the binary quantities, 220 and 230, while still calling them MB and GB. IEC 80000-13 names those mebibyte (MiB) and gibibyte (GiB) precisely to end the ambiguity. The gap compounds: 7% at gigabytes, 10% at terabytes. A 64 GB card really does hold 64,000,000,000 bytes; a system that reports it as 59.6 GB is showing you gibibytes. The TB to TiB storage calculator converts between the two.

Convention two: row padding. Formats that store rows independently usually pad each one to a whole number of bytes, or to a 4-byte boundary in the case of Windows BMP. At 24 bpp and an even width this changes nothing; at 1 bpp, 10 bpp or 12 bpp it adds up. The calculator warns when your bits per pixel is not a multiple of eight, and the real file will then be a little larger than the ideal figure.

The mipmap third. A mipmap chain stores the texture at half resolution, then a quarter, and so on. Each level has one quarter the pixels of the one above, so the total is 1 + 1/4 + 1/16 + 1/64 + …, a geometric series with ratio 1/4 that sums to 4/3. A full chain therefore costs exactly one third more than the base image — a useful constant to have memorised, and one that does not depend on the texture's size.

Worked example: a 24 MP shoot onto a 64 GB card

You are shooting a 6000 × 4000 sensor and exporting 8-bit RGB JPEGs at a quality setting that historically gives you about 8:1 on this kind of subject. The card is 64 GB and you expect around 500 frames.

  1. Pixels. 6,000 × 4,000 = 24,000,000, which is 24 MP.
  2. Bits per pixel. 3 channels × 8 bits = 24 bpp, so 3 bytes per pixel.
  3. Uncompressed bytes. 24,000,000 × 24 ÷ 8 = 72,000,000 bytes, which is 72 MB.
  4. Compressed estimate. 72,000,000 ÷ 8 = 9,000,000 bytes, or 9 MB per frame.
  5. Frames on the card. 64,000,000,000 ÷ 9,000,000 = 7,111.1, so 7,111 whole images.
  6. Storage for the shoot. 500 × 9,000,000 = 4,500,000,000 bytes, which is 4.5 GB.

Now shoot raw instead. A 14-bit single-channel raw from the same sensor is 24,000,000 × 14 ÷ 8 = 42,000,000 bytes, and lossless raw compression typically lands somewhere near 1.5:1, giving about 28 MB a frame — roughly three times the JPEG. The card now holds about 64,000,000,000 ÷ 28,000,000 = 2,285 frames, and the 500-frame shoot needs 14 GB. Shooting raw and JPEG together costs the sum of the two, 37 MB a frame, and cuts the card to about 1,729 frames.

The same 6000 × 4000 image as a 16-bit RGB working file in an editor is 24,000,000 × 48 ÷ 8 = 144,000,000 bytes, and every additional layer at full size adds another 144 MB before the editor's own compression. That is why layered masters outgrow their originals so quickly.

How to use the numbers

For a card, plan on fewer frames than the calculation gives. The capacity printed on the card is before formatting, the filesystem consumes some of it, sidecar and thumbnail files add a little, and file sizes vary frame to frame — a burst of detailed subjects will be larger than your average. Treating the calculated count as a ceiling and carrying a second card is the practical response.

For a web page, the uncompressed figure is the one that matters for memory even though the compressed figure is what crosses the network. A browser decodes a 4000 × 3000 JPEG into 48 MB of RGBA pixels regardless of the fact that the file was 2 MB, and it does that for every image on the page. Serving a 400 × 300 version instead reduces the decoded footprint by a factor of 100, which is why responsive image sizes matter more for memory-constrained devices than the download size suggests.

For a GPU, the uncompressed figure is the memory cost unless you use a block-compressed format. BC1/DXT1 stores 4 bits per pixel and BC3/DXT5 stores 8, against 32 for uncompressed RGBA — a fixed 8× or 4× saving that the hardware decodes on the fly, unlike a JPEG which must be fully decoded into a bitmap first. Add the mipmap third on top of whichever you choose. A texture budget is quickly consumed: 200 textures at 1024 × 1024 RGBA with mipmaps is 200 × 5.59 MB = 1.12 GB.

For archives, multiply by every copy. A working master, an offsite backup and a delivery export are three copies, and a versioned system may hold many more. The total-storage output here covers one copy of one set; multiply by your retention policy before sizing a disk, and check the result against the backup retention storage calculator.

If you need to embed an image directly in HTML or JSON rather than linking to it, remember that base64 adds a third to whatever the compressed size is. The base64 encoded size calculator gives the exact figure including padding.

Bytes per pixel and megabytes per megapixel

Every figure is channels × bits ÷ 8. The last column applies the rate to a 24-megapixel frame, so a 24 MP 8-bit RGB image is 24 × 3 = 72 MB.
Pixel formatBits per pixelBytes per pixelMB per megapixel24 MP frame
1-bit bilevel10.1250.1253 MB
8-bit grayscale81124 MB
12-bit Bayer raw121.51.536 MB
14-bit Bayer raw141.751.7542 MB
8-bit RGB243372 MB
10-bit RGB303.753.7590 MB
8-bit RGBA324496 MB
12-bit RGB364.54.5108 MB
16-bit RGB4866144 MB
16-bit RGBA6488192 MB
32-bit float RGBA (HDR)1281616384 MB

Megabytes here are 10⁶ bytes, so MB per megapixel and bytes per pixel are numerically identical — a convenient coincidence of the decimal convention that does not hold if you work in mebibytes.

Compression ratio is an assumption, not a calculation

No formula predicts what a lossy encoder will produce, because the output size depends on the content. Detail, noise, texture and grain all resist compression; flat areas and smooth gradients do not. Two frames from the same camera at the same quality setting can differ by a factor of three, and raising ISO — which adds noise — reliably increases file size at a fixed quality setting.

The only trustworthy ratio is one you measure. Encode twenty representative frames at your chosen settings, add up the file sizes, and divide the total bitmap size by the total file size. Use that number here. If you are sizing a card for a job you have not shot yet, take the ratio from the most detailed subject you expect rather than the average, and keep the headroom.

Lossless formats behave differently again. PNG on a photograph often achieves little better than 1.5:1, while PNG on a screenshot with large flat regions can exceed 10:1 — the opposite ordering to what people expect from a lossy encoder.

What this calculation leaves out

  • Metadata. EXIF, IPTC and XMP blocks are typically a few kilobytes, and an embedded ICC profile adds a few more. Negligible for a photograph, significant for a large set of tiny icons.
  • Embedded previews. Raw files usually carry a full-size JPEG preview so that the camera and file browser can display them, which can add several megabytes per frame.
  • Filesystem overhead. Files occupy whole allocation units. With a 32 KB cluster size, a set of small thumbnails wastes an average of 16 KB each.
  • Row padding. Formats that align each row to a byte or a 4-byte boundary add a little, and the effect is largest at low bit depths and awkward widths.
  • Chroma subsampling. JPEG at 4:2:0 stores colour at quarter resolution before the transform stage, which is part of why the achieved ratio is high. It is folded into your measured ratio, not modelled separately.
  • Alpha you did not ask for. Many editors save RGBA even when the image is fully opaque, adding a third to an 8-bit file.
  • Layers, masks and history. A layered master is a multiple of the flattened size, and a smart-object copy of the original can double it again.

Key terms

Bits per pixel (bpp)
Channels multiplied by bits per channel. The single number that, with the pixel count, determines uncompressed size.
Bayer raw
Sensor data stored as one sample per photosite behind a colour filter array. Full colour is interpolated later, so a raw file is roughly one third the size of the RGB image it becomes.
Mipmap
A precomputed chain of successively half-sized copies of a texture, used to avoid aliasing when the texture is drawn small. A complete chain adds exactly one third to the memory footprint.
Block compression
GPU texture formats such as BC1 and BC3 that store fixed-size compressed blocks the hardware decodes during sampling, giving a constant 4× or 8× saving with no decode step.
Mebibyte (MiB)
2²⁰ = 1,048,576 bytes, defined in IEC 80000-13 to distinguish the binary quantity from the SI megabyte of 10⁶ bytes. The two differ by about 4.9%.

Where image size sits among the other media calculations

Still images and video are the same arithmetic with time added. A video frame costs exactly what this calculator says, and an uncompressed stream costs that per frame times the frame rate — which is why uncompressed video is essentially never stored and why codecs work across frames rather than within one. Size a delivery stream with the video bitrate and file size calculator, which starts from a bitrate rather than from a per-frame bitmap.

Two neighbouring questions come up constantly alongside this one. How many pixels you need in the first place depends on how large the image will be reproduced and how close the viewer is, which is a pixel-density question — see the screen PPI and pixel density calculator. And whether your target dimensions preserve the source framing is an aspect ratio question, which decides how much of the frame a resize crops away.

Finally, if you are evaluating a codec or a storage system rather than a single file, the useful figure is the ratio itself rather than either size. The data compression ratio calculator converts between ratios, percentage space saved and bits per pixel, which are three ways of stating the same measurement and are routinely confused in specifications.

Frequently asked questions

How big is a 24-megapixel photo?

It depends entirely on the format. As an 8-bit RGB bitmap it is 72 MB, as a 16-bit RGB working file 144 MB, as a 14-bit raw 42 MB before lossless compression, and as a JPEG at a typical 8:1 to 12:1 ratio somewhere between 6 MB and 9 MB. The megapixel figure alone determines none of this — you need the channel count and the bit depth as well.

How many photos fit on a 64 GB card?

Divide 64,000,000,000 by your average file size. At 9 MB per JPEG that is about 7,111 frames; at 28 MB per compressed raw it is about 2,285; shooting raw and JPEG together at 37 MB a frame gives about 1,729. Plan on somewhat fewer, because the printed capacity is before formatting and file sizes vary with subject detail.

Why is my raw file smaller than three times the JPEG?

Because a raw file stores one sample per photosite, not three. The sensor sits behind a colour filter array, so each location records only red, green or blue; the other two are interpolated during demosaicing. A 24 MP 14-bit raw is therefore 24,000,000 × 14 ÷ 8 = 42 MB before compression, not the 126 MB you would get by treating it as three 14-bit channels. Set the channel count to 1 in this calculator to model raw correctly.

Does a PNG compress better than a JPEG?

On photographs, no — PNG is lossless and often achieves little better than 1.5:1 where a JPEG at a visually acceptable quality reaches 10:1 or more. On screenshots, line art and images with large flat areas, PNG frequently wins outright and can exceed 10:1 while remaining pixel-exact. The rule is about content, not format: lossless compression exploits repetition, and photographs have very little of it.

Why does my 64 GB card show as 59.6 GB?

Because the card is measured in decimal gigabytes of 10⁹ bytes and your operating system is reporting binary gibibytes of 2³⁰ bytes while labelling them GB. 64,000,000,000 ÷ 1,073,741,824 = 59.6. Nothing is missing; the two units differ by about 7% at this scale, and by about 10% at terabytes. IEC 80000-13 defines GiB for the binary quantity precisely to remove the ambiguity.

How much video memory does a texture use?

The uncompressed pixel count times bytes per pixel, plus a third if it has mipmaps, unless you use a block-compressed format. A 1024 × 1024 RGBA texture is 4,194,304 bytes; with a full mipmap chain it is 5,592,405 bytes. In BC3/DXT5 at 8 bits per pixel the same texture is 1,048,576 bytes, or 1,398,101 with mipmaps. A JPEG on disk tells you nothing about this, because the GPU cannot sample a JPEG — it must be decoded into pixels first.

Does bit depth change the file size of a JPEG?

Baseline JPEG only stores 8 bits per channel, so the question does not arise for that format — a 16-bit image is reduced to 8 bits on export. Bit depth matters for formats that support it: TIFF, PNG at 16 bits, JPEG 2000, HEIF and camera raw. Where it applies, doubling the bit depth doubles the uncompressed size and increases the compressed size by rather less, because the extra low-order bits are close to random and compress poorly.

What compression ratio should I assume for JPEG?

Measure rather than assume, because the achieved ratio depends on both the quality setting and the content. The reliable method is to export twenty representative frames at your chosen settings, sum the file sizes, and divide the total bitmap size by that sum. If you must guess before you have data, use the most detailed subject you expect rather than an average, since underestimating file size is what fills a card mid-shoot.

Why does adding an alpha channel cost a third more?

Because you go from three samples per pixel to four, and 4 ÷ 3 is a 33% increase. At 8 bits per channel that is 24 bpp becoming 32 bpp, so a 24 MP image goes from 72 MB to 96 MB. Many editors save RGBA by default even when every pixel is fully opaque, so it is worth checking your export settings if file sizes look a third larger than you expected.

References

  • IEC 80000-13:2008, Quantities and units — Part 13: Information science and technology — International Electrotechnical Commission
  • ISO/IEC 10918-1 (JPEG), Digital compression and coding of continuous-tone still images — International Organization for Standardization
  • Portable Network Graphics (PNG) Specification, Third EditionWorld Wide Web Consortium