Most free background removers work the same way: you upload your photo to someone's server, their GPU cuts out the subject, and you get back a low-resolution preview unless you pay or sign up. For a product shot that's fine. For a photo of your kid, your ID, or an unreleased product, it's a lot of trust to hand a website.
It no longer has to work that way. Browsers can now run the same kind of segmentation model on your own device, and the Background Remover on this site does exactly that. The image never leaves your computer. This post explains how that works, why the first run is slower than the second, and a WebGPU limit that broke the first model I chose on every Mac.
How it works
Three pieces make in-browser background removal possible:
- A segmentation model exported to ONNX. ONNX is a portable format for neural networks. The model looks at an image and outputs a mask: a value from 0 to 255 for every pixel saying how confident it is that the pixel belongs to the subject.
- ONNX Runtime Web. A runtime that executes ONNX models inside the browser, using WebAssembly on the CPU or WebGPU on the graphics card.
- Transformers.js. A JavaScript library from Hugging Face that handles downloading the model, resizing the image to what the model expects, running it, and turning the output back into an image.
Once the mask comes back, the rest is plain canvas work: draw the original photo, replace each pixel's alpha channel with the mask value, and export a PNG. Transparent where the model says "background," opaque where it says "subject," and soft in between, which is what keeps hair and edges from looking cut out with scissors.
Why the first run is slower
The model has to get to your browser somehow. The first time you use the tool, it downloads the weights from Hugging Face, about 88 MB for the general-purpose object model with WebGPU (about 44 MB in a smaller CPU version), or about 7 MB for the portrait model. Your browser caches them, so the next image, and your next visit, skip the download and go straight to processing.
On a recent laptop with WebGPU, processing an image takes a few seconds. Without WebGPU, the CPU path is slower but still works. In testing, a 1024-pixel photo took about 4 seconds with the portrait model and about 10 with the object model on CPU alone.
The GPU bug: "Too many storage buffers in shader"
The first model I picked was BiRefNet lite, a high-quality, MIT-licensed segmentation model with a ready-made ONNX export on Hugging Face. It downloaded fine, and then failed on the first image:
Too many storage buffers in shader. Current: 11, Max is 10
WebGPU exposes hardware limits to every page, and one of them is maxStorageBuffersPerShaderStage: how many separate data buffers a single GPU shader can bind at once. Some of the operations in BiRefNet compile to shaders that need 11. The Apple GPU in Chrome on my Mac reported a limit of 10, in headless and normal Chrome alike. So the model that worked in a demo on one machine would have failed for every visitor on a Mac.
There were three options:
- Fall back to the CPU whenever WebGPU fails. That works, but it means a roughly 224 MB download and a slow run for every Mac user.
- Request higher limits from the GPU. That doesn't help when the hardware limit itself is 10.
- Use a model whose shaders fit.
I went with the third. The tool now uses ormbg, an open, Apache 2.0 background-removal model whose shaders stay within the limit. It handles products, animals, and people, and runs on Apple GPUs in a few seconds. For portraits there's MODNet (also Apache 2.0), which is tuned for people and is only about 7 MB.
The lesson applies well beyond background removal: if you ship WebGPU models, test on the GPUs your users have, not just the one on your desk. A model that "runs in the browser" may only run in some browsers.
Privacy: what actually leaves your device
With an on-device tool, it's worth being specific:
- Your image: never uploaded. It's read into the page, processed in memory, and exported as a PNG you download.
- The model weights: downloaded once from Hugging Face's servers, which see an ordinary file download, not your image.
- The runtime: the ONNX Runtime WebAssembly files load from the jsDelivr CDN.
That's verifiable: open your browser's network panel while you process an image and you'll see the model download but no upload.
Getting a clean cut-out
A few things make a noticeable difference:
- Pick the right model. "Any object" for products, pets, and scenes; "Portraits" for people, especially head-and-shoulders shots.
- Use the original photo, not a screenshot of it. Compression artifacts around edges confuse every model.
- Contrast helps. A subject that's clearly separated from the background, by color or by focus, cuts out more cleanly.
- Expect trouble with fine hair, glass, and smoke. These are hard for every model.
- Export transparent PNG for design work, or pick a white or custom background for product listings and profile photos. JPG can't store transparency, so the tool always exports PNG.
Very large photos are scaled to 4,096 pixels on the long side before processing. That's well above what the models work at internally, and it keeps the browser from running out of memory on a 50-megapixel camera file.
Try it
Remove a background: no upload, no sign-up, no watermark, full resolution. If you're squeezing the result for the web afterwards, the Image Compressor also runs entirely in your browser.