Every raster you download is a rectangle: a satellite scene, a DEM tile, an aerial survey, all grids with corners your project does not care about. Your study area, meanwhile, is a watershed, a municipality, a farm, a flood zone, some irregular polygon that no rectangle has ever matched. Clipping is the operation that reconciles the two, and in QGIS the tool is Clip Raster by Mask Layer. It keeps every cell inside your polygon, replaces the outside with NoData, and hands you a raster that is about your place instead of about the tile the data happened to ship in. The operation is simple and the failure modes are all in the setup: mismatched coordinate systems, a mask that does not overlap, a NoData value chosen by default and regretted later. This guide runs the clip the careful way, checks first, decisions named, verification after, so the output can be trusted downstream.
Home / GIS and Open Map Data for Beginners
QGIS Clip Raster: Cut Imagery and DEMs to Your Boundary With a Mask Layer

Photo: Văn Long Bùi / Pexels
Clip It Clean: The Raster Clip Checklist
Check off each step as you finish it. Your progress stays on this page.
0 of 8 complete
0% done
The Tool: Clip Raster by Mask Layer
You will find the tool in two places that run the same engine: the Raster menu, under Extraction, as Clip Raster by Mask Layer, and the Processing Toolbox, in the GDAL raster extraction group, which is the version worth learning because it exposes every parameter and can be dropped into models and batch runs. Under the hood it is a GDAL operation, and its logic is worth understanding because it explains the output's shape. The tool does not cut the grid into a polygon, because rasters cannot be polygons: the output is still a rectangular grid. What changes is the content. Cells whose centers fall inside the mask keep their values; cells outside are written as NoData, the raster's way of saying nothing here. Optionally, the rectangle itself shrinks to the mask's extent, which is where the file size savings come from. So a clipped raster is a smaller rectangle wearing a NoData stencil of your boundary, and every later calculation, statistics, classification, area sums, respects the stencil automatically.
Before You Clip: Overlap, CRS, and Resolution
Three checks, two minutes, and they prevent essentially every failed clip. First, overlap: display the raster and the mask together and confirm they actually cover the same ground. A mask of your study area in one region and a raster of another is the most common cause of the infamous empty output, and no parameter fixes geography. Second, coordinate reference systems: confirm the mask and the raster are in compatible CRSs, and be suspicious of the map display, because QGIS reprojects layers on the fly for display, so two layers can look perfectly aligned on screen while their stored coordinates live in different systems. The clip operation works in stored coordinates, not in display coordinates. If the systems differ, reproject one properly first; our guide to georeferencing an image in QGIS covers the related discipline of making raster coordinates honest. Third, resolution: note the raster's cell size, because you are about to decide whether the output keeps it, and an accidental resample at this stage quietly changes every statistic computed later.
The Run, Step by Step
With the checks done, the run itself is short. Open Clip Raster by Mask Layer from the Processing Toolbox. Set the input layer to the raster you are cutting and the mask layer to the polygon whose shape you want. Decide the NoData value now, in the field provided for assigning a NoData value to the output bands; the next section explains the choice. Tick the option to crop the output extent to the extent of the mask, so the rectangle shrinks to your area instead of keeping the full tile's corners. Choose to keep the resolution of the input raster unless you have a deliberate reason to resample. Then, the step new users skip and regret: save to a real file rather than accepting a temporary layer, in a format with room for your data, GeoTIFF for almost everything. Run it. The output loads as a new layer, your raster wearing the shape of your boundary, with the familiar checkerboard of transparency where NoData shows through in the QGIS display.

The Three Decisions That Shape the Result
The parameters most users leave alone are the ones that determine whether the clip is an asset or a subtle problem. NoData first. The value you assign marks every outside cell, and it must be a value your data cannot legitimately contain: for elevation in meters, a value like -9999 is safely outside any terrain on Earth, while 0 is a trap, because 0 is real elevation at every coastline and real data in plenty of other rasters, and choosing it makes sea-level ground indistinguishable from outside the study area in every later calculation. Second, resolution. Keeping the input resolution preserves the data exactly; setting a new one resamples, which smooths, shifts, and invents values. Resampling has legitimate purposes, matching another dataset's grid above all, but it should be a decision, never a side effect. Third, extent. Cropping to the mask's extent discards the dead corners of the rectangle; skipping the crop keeps the original grid alignment, which matters when the clipped raster must stay cell-aligned with siblings for map algebra. Neither choice is wrong in itself. What is wrong is not knowing which one your analysis needs.
Clip by Mask vs Clip by Extent
The mask tool has a sibling, Clip Raster by Extent, and choosing between them is a real decision. Extent clipping cuts to a rectangle you specify, by typing coordinates or dragging on the map: fast, predictable, and exactly right when your area of interest genuinely is a box, a tile subset for a model run, a test area, a quick crop to shrink a file before sharing. Mask clipping follows a polygon's true shape and is right when the boundary itself carries meaning, a watershed divide, a protected area, an administrative border, because statistics computed over a rectangle that spills outside the real boundary are statistics about the wrong place. A workflow worth knowing combines them: extent-clip a huge scene down to a generous box around your area first, for speed and file size, then mask-clip the result to the true boundary for analysis. And when the boundary lives in vector form and your next step is summarizing raster values per polygon, remember that QGIS can often skip the clip entirely with zonal statistics; but when you need the cut raster itself, for a heatmap, a classification, or delivery to someone else, the mask clip is the tool.
When One Clip Becomes Fifty: Batch and Models
Sooner or later the single clip becomes a stack of them: a year's worth of scenes to cut to the same boundary, a DEM and its slope and hillshade derivatives, a folder of survey tiles. The Processing Toolbox version of the tool is built for this. Right-clicking the algorithm offers a batch mode that runs the same clip over many inputs with the same mask and settings, writing each output to a name you pattern in advance. Better still, the model designer lets you chain the clip into the workflow that follows it, clip, then compute statistics, then classify, so the whole sequence runs as one tool and, more importantly, runs identically every time: the same NoData decision, the same extent choice, applied to the fiftieth raster exactly as to the first. That repeatability is the real prize. Manual clipping invites drift, one output at full extent, one resampled by accident, one saved over a temporary layer that vanished with the session. A model or a batch definition is the clip as a decision, recorded once and executed without improvisation. For work that lives outside the QGIS window entirely, the same GDAL operation is available from the command line and from QGIS's own standalone processing runner, so a scheduled job can clip new scenes to your boundary the night they are published. However you scale it, scale the verification too: a batch of fifty deserves a scripted sanity check on extents and statistics, not fifty hopeful glances.
After the Clip: Verify Before You Trust
A clip that ran without errors has not necessarily clipped correctly, and two minutes of verification protects everything downstream. Look at the corners: zoom to the mask's boundary in a few places and confirm the raster's edge follows it, with NoData outside and data inside, no offset sliver betraying a CRS mismatch. Check the cell count and dimensions in the layer properties against your expectation; a clipped raster should be smaller than the source, and one that is not has kept the full extent. Compare statistics: run the raster statistics and confirm the minimum and maximum are plausible for your area, because a clip that accidentally sampled the wrong region announces itself in impossible values, ocean depths in a mountain study, city elevations in a desert. Finally, overlay the mask outline on the result and pan the whole boundary once. The failures this catches, a one-cell shift, a mask of the neighboring district, a NoData value colliding with real data, are all cheap to fix now and expensive to discover after the maps are made. The same verify-the-output habit governs the rest of the QGIS workflow, from a spatial join to an area calculation: the tool ran is not the same claim as the tool worked.
Related Guides
This guide does not stand alone. The GIS and open map data guides below take up the questions it leads into:
- QGIS Reproject Layer: Change a Layer's CRS Without Breaking Its Geometry: Reprojecting a layer means rewriting its coordinates in a different coordinate reference system, so the same ground gets new numbers.
- How to Draw a Polygon in QGIS: Digitizing a Boundary That Closes Cleanly: Drawing a polygon is the moment a QGIS user stops consuming maps and starts making them: a field boundary, a study area, a zoning line, traced...
- How to Merge Layers in QGIS: One Layer, Same Geometry, Shared CRS: Twelve district files that should be one province, four quarterly exports that should be one year: merging layers is the janitorial task every GIS...
- QGIS Raster Calculator: Band Math, Worked Expressions, and the Nodata Traps: do the math after the clip
- QGIS Zonal Statistics: Summarize a Raster by Polygon Zones: summarize the clipped grid by zones
Frequently Asked Questions
Does clipping a raster change my original file?
No. Clip Raster by Mask Layer reads the input and writes a new raster; the original is untouched. This is why saving the output to a deliberate file, with a name that says what it is, matters: you end up with the source rectangle and your clipped version side by side, and only the names distinguish them.
Why is my clipped raster still rectangular?
Because rasters are always grids. The clip replaces everything outside your mask with NoData rather than cutting the grid into a polygon shape. QGIS displays NoData as transparent, so the result looks like your boundary, and every calculation ignores the NoData cells, which is the behavior that actually matters.
Why did my clip come out empty or in the wrong place?
Almost always a coordinate problem: the mask and the raster stored in different CRSs, or a mask that does not overlap the raster at all. The map display hides CRS mismatches by reprojecting on the fly, so check the layers' actual CRSs in their properties, reproject one to match, and confirm the two overlap before running the clip again.
Can I clip a raster using another raster as the mask?
Not with this tool: the mask must be a vector layer, a polygon. If your intended boundary exists only as raster data, the usual routes are to polygonize the relevant class into a vector layer first, or to use raster calculator and extraction workflows that treat one grid as a stencil for another.
Does clipping make the file smaller?
Cropping the extent to the mask does, often dramatically, because the discarded corners are gone entirely. The NoData region inside the rectangle still occupies cells, though compressed formats like GeoTIFF with compression store long runs of identical NoData very cheaply, so a mask-clipped and compressed file is usually far smaller than the source tile.
Photo credits: Văn Long Bùi (Pexels); Fatih Turan (Pexels). Photos are served from this site; follow the credit to the library page for the original.