How to use layer masks

By Pixuvia · · Updated

The Editor with a mountain range on the left fading into a sunset sea on the right, blended by a layer mask whose black-to-white gradient thumbnail is framed on the sea layer in the Layers panel.

Layer masks hide parts of a layer without erasing them. Each mask is a grayscale image attached to one layer: white shows the layer, black hides it, and gray makes it partly see-through. Paint the mask and the layer changes on screen, while its pixels stay intact underneath.

This layer mask tutorial uses the Pixuvia online photo editor, which follows Photoshop's menu names, so the same steps carry over to Photoshop. You will add a mask, paint it, blend two photos with a gradient, and learn which mask commands to reach for. New to layers? Start with layers explained, then come back here.

On this page
  1. What is a layer mask?
  2. Why use a mask instead of the Eraser?
  3. How to add and paint a layer mask
  4. How to paint on a layer mask
  5. Example: blend two photos with a layer mask
  6. How to make a layer mask from a selection
  7. Layer mask commands and shortcuts
  8. Layer mask vs vector mask vs clipping mask
  9. Layer masks on adjustment layers
  10. Do layer masks survive in PSD files?
  11. Questions
  12. Sources

What is a layer mask?

A layer mask is a black-and-white map of where a layer is visible. White areas of the mask show the layer, black areas hide it, and every shade of gray in between hides it partly: 50% gray leaves the layer about half transparent. The layer underneath shows through wherever the mask is dark.

Why use a mask instead of the Eraser?

The Eraser deletes pixels. Once you save and close, or run out of undo steps, those pixels are gone. A mask only hides them, so you can paint white to bring back any area a day later.

That makes masks the safer choice for cutouts, composites and local edits. You can also turn a mask off to compare before and after, or delete it to get the whole layer back. Photoshop users call this non-destructive editing.

How to add and paint a layer mask

  1. Open your photo in the Editor and click the layer you want to mask in the Layers panel. The Background layer cannot take a mask, so click its lock first to turn it into a normal layer.
  2. Click Add Layer Mask at the bottom of the Layers panel, or choose Layer > Layer Mask > Reveal All. A white mask thumbnail appears next to the layer thumbnail with a frame around it, which means your tools now paint the mask.
  3. Press D for the default colors: black foreground, white background.
  4. Press B for the Brush tool. Click the brush tip button (or right-click the canvas) to set the Size, and lower the Hardness for a soft edge.
  5. Paint black over the parts you want to hide. Press X to swap to white and paint back anything you hid by mistake.
  6. Lower the brush Opacity to paint gray, which hides an area only partly.
  7. Click the layer thumbnail to go back to editing the layer's own pixels, or press Ctrl+\ (Cmd+\ on a Mac) to switch between the mask and the pixels.
Opens the full-size image: The Layers panel with two layers, sea above mountains. The sea layer shows its photo thumbnail, a link icon and a black-to-white mask thumbnail with an orange frame around it.
The frame around the mask thumbnail shows that the mask is targeted, so your tools paint the mask instead of the photo.

If you had a selection when you clicked Add Layer Mask, the new mask reveals only the selection and hides the rest. Without one, the mask starts white and shows the whole layer, which is the same as Layer > Layer Mask > Reveal All.

How to paint on a layer mask

Painting a mask comes down to three choices: color, edge and strength. Black hides and white reveals. A low Hardness gives a soft, gradual edge that blends naturally, while 100% Hardness gives a crisp one. Brush Opacity sets how strongly each stroke hides or reveals.

  • Resize the brush as you go with [ and ], large for broad areas and small for edges.
  • Check the mask itself with \, which shows it over the canvas. Holes and stray marks are easy to spot there. Press \ again to go back to the image.
  • Compare before and after by Shift-clicking the mask thumbnail, which turns the mask off and on.
  • Any color works. The mask only stores gray, so a colored brush paints the gray of that color. Pressing D first keeps it to pure black and white.

Example: blend two photos with a layer mask

A gradient on a mask fades one photo smoothly into another, such as a sky into a landscape or two portraits side by side. Here is the full workflow.

  1. Open the first photo. Then choose File > Place Image… and pick the second photo. It comes in as a new layer on top, scaled down to fit and centered.
  2. Press V for the Move tool and drag the top photo so the two overlap where you want the blend.
  3. With the top layer selected, click Add Layer Mask in the Layers panel.
  4. Press D for black and white, then G for the fill tools. Shift+G switches between Paint Bucket and Gradient; pick Gradient. Its default is a linear Foreground to Background gradient.
  5. Drag across the overlap. Where you start, the mask turns black and the top photo disappears; where you stop, it turns white and the top photo shows fully.
  6. A short drag gives a hard transition, a long drag a gentle one. Not right? Undo with Ctrl+Z (Cmd+Z on a Mac) and drag again.
  7. Touch up with a soft black or white brush where something from one photo pokes through, such as a tree or a face.

How to make a layer mask from a selection

For a cutout, start from a selection instead of painting by hand. Choose Select > Subject, which finds the most prominent object in the image, or use the Lasso, Quick Selection or Object Selection tools. Then click Add Layer Mask: the subject stays and the background is hidden. The bar that appears next to a selection on the canvas offers Add Layer Mask too.

Hair and fur need a softer edge. Choose Select > Select and Mask… (Ctrl+Alt+R, Cmd+Option+R on a Mac), adjust Radius, Smooth, Feather and Shift Edge, and set Output To to Layer Mask. For a one-step cutout, Layer > Layer Mask > Remove Background builds a mask that reveals the layer's subject. The guide to removing a background in the Editor covers cutouts in more depth.

Layer mask commands and shortcuts

Every layer mask command lives under Layer > Layer Mask. Right-click a mask thumbnail in the Layers panel for the same list. Shortcuts use Ctrl on Windows and Linux and Cmd on a Mac.

Opens the full-size image: The canvas shows the layer mask itself, a smooth gradient from black on the left to white on the right, with Viewing mask highlighted above it and the masked sea layer selected in the Layers panel.
View Mask shows the mask in grayscale: black hides the top photo, white shows it and the grays in between blend the two.
CommandShortcutWhat it does
Reveal AllAdd Layer Mask buttonAdds a white mask that shows the whole layer.
Hide AllNoneAdds a black mask that hides the whole layer, ready to paint parts back in with white.
Reveal SelectionAdd Layer Mask button with a selectionShows the selected area and hides the rest.
Hide SelectionNoneHides the selected area and shows the rest.
Edit Mask / Edit Layer PixelsCtrl+\Switches what your tools paint: the mask or the layer.
View Mask\ or Alt-click the thumbnailShows the mask over the canvas so you can check it.
Disable / Enable MaskShift-click the thumbnailTurns the mask off and on without losing it.
Invert MaskCtrl+ISwaps what is shown and hidden. Works when the mask is targeted.
Link / Unlink MaskNoneLinked, the mask moves with the layer. Unlinked, it stays in place while you move the layer.
Apply MaskNoneRemoves the hidden pixels for good and drops the mask. Text and shape layers are turned into pixels first, after you confirm.
Delete MaskNoneRemoves the mask and shows the whole layer again.

Layer mask vs vector mask vs clipping mask

All three hide parts of a layer, but they get their shape from different places. A layer mask is painted pixels, a vector mask is a path, and a clipping mask borrows the shape of the layer below.

Mask typeShape comes fromBest forHow to add it
Layer maskGray pixels you paintSoft edges, hair, blends and gradual fadesAdd Layer Mask button or Layer > Layer Mask
Vector maskA path drawn with the Pen toolCrisp, sharp edges that stay sharp at any sizeLayer > Vector Mask, or click Add Layer Mask again on a layer that already has a layer mask
Clipping maskThe pixels of the layer belowPutting a photo or texture inside text or a shapeLayer > Create Clipping Mask (Ctrl+Alt+G)

A layer can have a layer mask and a vector mask at the same time. Vector masks don't go on shape layers (their path already is the mask), adjustment layers or the Background.

Layer masks on adjustment layers

Every adjustment layer comes with its own mask, so an edit like Curves or Hue/Saturation can apply to one part of the photo only. Add one with Layer > New Adjustment Layer or the New Adjustment Layer button in the Layers panel. The mask starts white, or reveals your selection if you had one.

An adjustment layer has no pixels of its own, so your brush always paints its mask. Paint black where the adjustment should not apply, for example to brighten a face but keep the background as it was. Apply Mask isn't offered on adjustment layers, since there are no pixels to cut.

Do layer masks survive in PSD files?

Yes. When the Editor opens a PSD, layer masks come in on their layers, including whether each one is on or off, and adjustment layers keep their masks. Saving with File > Export As > PSD writes them back the same way, so a file can go between Pixuvia, Photoshop and other PSD editors with its masks still editable.

One limit to know: masks on groups are not kept. Masks on the layers inside a group are. Exporting to PNG or JPG flattens the image, so the masks are applied to the result and can't be edited later; keep a PSD copy if you may want to change them. See the online PSD editor page for what else a PSD keeps, or convert a PSD to PNG once you're done.

Questions

What does a layer mask do?

A layer mask controls which parts of a layer are visible. White areas of the mask show the layer, black areas hide it and gray areas make it partly transparent. The layer's pixels are never deleted, so you can change the mask at any time.

Why is my brush painting on the photo instead of the mask?

The layer thumbnail is targeted instead of the mask thumbnail. Click the mask thumbnail in the Layers panel (it gets a frame) or press Ctrl+\ (Cmd+\ on a Mac), then paint again.

How do I invert a layer mask?

With the mask targeted, press Ctrl+I (Cmd+I on a Mac) or choose Layer > Layer Mask > Invert Mask. Everything the mask showed is now hidden and the other way round.

Can I use layer masks without Photoshop?

Yes. The Pixuvia Editor runs in the browser and has layer masks with the same Photoshop names: Reveal All, Hide All, Invert Mask, Apply Mask and the rest. It also opens and saves PSD files with their layer masks.

What is the difference between Delete Mask and Apply Mask?

Delete Mask removes the mask and shows the whole layer again. Apply Mask removes the hidden pixels for good and keeps only what the mask showed, so the layer no longer needs a mask.

Sources