Blog/Developer Tools
Developer ToolsOctober 2026 · 11 min read

How to Reduce Electron App Size: Images, ASAR and Installer Tips

An Electron app always ships the Chromium and Node runtime, so you cannot shrink that part. What you control is your code, dependencies and assets. Remove unused files from the package, right-size and compress images, prefer WebP for renderer images, and measure the unpacked app and the installer separately.

Electron makes it easy to ship a desktop app with web technology, and the price is size. Every Electron app carries a copy of Chromium and Node.js, so even a "hello world" installer is far bigger than a native app of the same feature set. Developers often stop there and accept it. But the part you control is frequently larger than it needs to be, and in many apps images are the biggest piece of it. Onboarding illustrations, marketing screens bundled into the app, tray icons at five sizes and oversized PNG exports add up quickly. This guide explains where Electron size comes from, what the ASAR archive does and does not do, and how to shrink the assets you ship.

Measure your own app

Sizes depend on your Electron version, platform, dependencies and packager settings. The steps below tell you how to measure, and the percentages you gain will depend entirely on your assets.

Where Electron app size comes from

An unpacked Electron app has three broad parts.

  1. The runtime: the Electron framework, which includes Chromium and Node.js, and locale files. This is fixed overhead for a given Electron version and platform.
  2. Your application code and dependencies, usually inside an app.asar archive or an app folder.
  3. Your assets: images, fonts, audio, video and data files, either inside the archive or alongside it.

You can only influence the second and third items, plus some choices around the runtime, such as which locales to include. Start by measuring how large each part is before you optimize anything.

Step 1: Measure the package and the installer

Build a production package and look at it from two angles. The unpacked application folder tells you how much disk space users need after installation. The installer, such as a DMG, MSI, NSIS setup or ZIP, tells you what users download, and it is compressed by the installer format. They are different numbers and you should track both.

  • On macOS, show package contents of the .app and inspect Contents/Resources, where app.asar and unpacked files live.
  • On Windows, look in the resources folder next to the executable.
  • List what is inside the archive with the asar command line tool, for example npx asar list app.asar, and look for unexpectedly large files.
  • Sort by size in a file manager or with du, and note the top twenty items.

Step 2: Understand what ASAR does

ASAR is Electron's archive format. It concatenates your app files into a single file with an index, which speeds up reading many small files and avoids path length problems on Windows. It does not compress the contents. A 50 megabyte folder of images becomes roughly a 50 megabyte archive. Compression happens later, when the installer or disk image format compresses the package for download, and image files such as PNG and JPEG are already compressed, so they gain little from it.

This is why image optimization matters so much for Electron. Once a PNG is in the archive, nothing else will shrink it. The size you commit is, to a first approximation, the size you ship.

Step 3: Keep unnecessary files out of the package

Packagers include whatever your configuration allows. A few habits trim that.

  • Use the files configuration in your packager to include only what the app needs, such as the built output, and exclude source maps, test fixtures, documentation and raw design exports.
  • Make sure development dependencies are not packaged. Check that your build installs only production dependencies.
  • Audit dependencies. Some libraries bundle large sample data, extra locale files or multiple copies of the same image set.
  • Remove duplicate images that exist both in the source folder and in a public or build folder.
  • Do not bundle marketing-size screenshots or videos unless the app needs them offline.

Step 4: Right-size the images

The window of an Electron app has a known maximum size, and most images appear much smaller. A background used in a 1200 by 800 pixel window needs at most about 2400 by 1600 pixels for high-density displays, and often far less. Work out the real display size of each image, multiply by 2 for retina screens and export at that size. This single step usually saves more than any encoder setting.

Step 5: Choose formats for the renderer

The renderer is Chromium, so you can use modern formats without worrying about old browsers. WebP is a strong default for photographs and illustrations, with lossy and lossless modes and transparency. AVIF can be smaller still, and Chromium supports it in current Electron versions, but it encodes more slowly and decoding uses a little more CPU, so test on low-end hardware if that matters. For icons and simple shapes, SVG avoids raster files altogether. Keep PNG for pixel-exact assets where lossless fidelity matters.

ContentGood choiceNotes
Photographs and large backgroundsWebP or AVIFCompare quality at full size
Interface illustrationsLossless WebP or quantized PNGCheck gradients for banding
Icons and glyphsSVGScales to any density
Pixel-exact spritesLossless PNGNo color changes
Tray and app iconsPlatform formatsSee next section

Step 6: Handle app and tray icons properly

Icons are small but easy to get wrong. On macOS the application icon is an .icns file containing several sizes. On Windows it is an .ico file that also contains multiple sizes. Tray icons are separate: macOS expects a small template image with @2x versions, and Windows and Linux use PNG at standard sizes. Provide only the sizes you need, make sure they are not oversized and compress the PNGs inside them where your toolchain allows. A 1024 pixel icon source is fine as a master, but the tray icon does not need to be that size.

Step 7: Compress what remains

After resizing and choosing formats, run the images through an optimizer. Lossless PNG optimization strips metadata and rewrites the data with no pixel change. Lossy quantization can shrink illustrations and interface graphics significantly, and you should compare the output at full size. JPEG sources can be re-encoded with an optimized encoder such as MozJPEG. Convert suitable PNG and JPEG files to WebP, and keep the originals out of the package.

TinyPixels does this locally on macOS and Windows. It compresses PNG with oxipng and imagequant, JPEG with MozJPEG and converts to WebP and AVIF, processes folders in parallel and can watch your assets directory so new files are optimized as soon as they land. Nothing is uploaded, which is useful for unreleased artwork, and Pro is a one-time purchase. Our guide on compressing Electron assets has a project-oriented walkthrough.

Step 8: Loading strategy

Not everything has to be in the installer. Large optional content, such as a gallery of templates or tutorial videos, can be downloaded on first use and cached in the user data directory. That keeps the installer lean and lets you update content without shipping a new build. The trade-off is that the first use needs a network connection and you must handle errors gracefully, so apply it to content that is big and rarely needed.

Step 9: Compare before and after

  1. Record the unpacked size and installer size for the current build.
  2. Apply one change at a time: exclude files, resize, convert, compress.
  3. Rebuild and record both sizes after each change so you know what worked.
  4. Run the app and look at every screen that uses changed images, at normal and high-density scales.
  5. Keep the numbers in your release notes or CI output.

Common mistakes

  • Assuming ASAR compresses files.
  • Shipping design exports at four times the display size.
  • Packaging development dependencies.
  • Leaving source maps and documentation in the package.
  • Converting images to AVIF for tiny icons where the overhead outweighs the saving.
  • Compressing already compressed images repeatedly instead of starting from originals.

Privacy-friendly tooling

Desktop apps often handle sensitive design files long before release. Uploading unreleased artwork to a web compressor exposes it to a third party. Local tools avoid that, and a watch folder removes the chance of forgetting. It is the same principle your app presumably follows for its own users' data.

Locales, native modules and other non-image weight

Images are rarely the only target. Electron ships locale files for many languages, and if your app supports only a few, you can configure your packager to keep just those. Native modules compiled for several architectures can double certain dependencies, and some libraries include prebuilt binaries for platforms you never target. Check what your dependency tree pulls in, and remove binaries for operating systems you do not support. These changes do not touch your images, but they often yield savings comparable to image work and are worth doing in the same session.

Universal builds and architectures

On macOS, a universal build contains code for both Intel and Apple silicon, which makes the app larger than a single-architecture build. Offering separate downloads per architecture shrinks each, at the cost of a slightly more complicated download page. Decide based on your audience and distribution channel. If you distribute through auto-update, make sure the updater selects the correct build for each machine. Windows builds have similar choices between 32-bit, 64-bit and ARM variants.

Updates and differential downloads

Size matters twice: at first install and at every update. Some updaters support differential downloads, which transfer only the parts of the app that changed. Keeping assets stable between releases, for example by not renaming or re-exporting unchanged images, helps differential updates stay small. Re-compressing every image on every release changes bytes needlessly, so compress once at the source and commit the result.

Testing on low-end machines

Smaller assets also help runtime behavior. Large images consume memory when decoded, and an Electron app that shows several full-size backgrounds can use hundreds of megabytes of RAM it does not need. Test on an older laptop with limited memory and watch the process memory in the task manager while you move through the app. If usage spikes on screens with big images, resize those images to their display size, which cuts decode time and memory along with file size.

Finally, document the asset rules for your team in the repository README: maximum pixel dimensions per slot, preferred formats and the folder where compressed files belong. A short guide prevents most oversized files from ever being committed.

Conclusion

You cannot make Chromium disappear, but you can make everything you add to it lean. Measure the package and the installer, keep unneeded files out, right-size and convert images, compress what is left and automate it. Because ASAR does not compress, your image choices go straight into the download. A few hours of cleanup commonly pays back in every release thereafter.

Frequently asked questions

Why is my Electron app so large?

Every Electron app includes Chromium and Node.js, which is fixed overhead. The size you control comes from your code, dependencies and assets such as images.

Does ASAR compress my files?

No. ASAR concatenates files into one archive with an index. Compression comes from the installer format, and already compressed images like PNG and JPEG gain little from it.

Which image format is best inside an Electron app?

WebP is a strong default for photos and illustrations because the renderer is Chromium. Use SVG for icons, and keep PNG for pixel-exact assets.

How do I see what is inside app.asar?

Use the asar command line tool, for example npx asar list app.asar, or extract it to a folder and sort by size.

How can I automate image compression for an Electron project?

A desktop tool with a watch folder, such as TinyPixels, can compress new images locally as they are added, with no build plugin.

Should I download large optional assets after install?

For big, rarely used content, yes. It keeps the installer small, but the first use needs a network connection and error handling.

Keep your Electron assets small automatically

Download TinyPixels — 100% local, zero uploads, one-time Pro purchase.