Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 37 ยท Masks and Compositing

Layer Masks: Hide and Reveal Without Erasing

Understand how Photoshop layer masks use black, white and gray to hide or reveal layers, how to paint and edit them, and why masks beat the Eraser.

A layer mask is a grayscale image attached to a layer. Where the mask is white, the layer is fully visible; where it is black, the layer is hidden; gray gives partial transparency. You never delete pixels, so every decision can be undone later by painting the opposite color. Masks are the single most important compositing tool in Photoshop.

Remember the rule: white reveals, black conceals. A common mnemonic is "white = show, black = hide".

Creating a mask

  • Select a layer and click the Add Layer Mask button (a rectangle with a circle) at the bottom of the Layers panel. This adds a white mask: the layer is fully visible.
  • Alt+click (Option+click) the same button to add a black mask: the layer starts hidden and you paint to reveal it.
  • With an active selection, clicking the button creates a mask that shows only the selected area.
  • Use Layer > Layer Mask > Reveal All / Hide All / Reveal Selection / Hide Selection.

The mask thumbnail appears beside the layer thumbnail, with a small chain icon linking them so they move together. Click the chain to unlink them, so you can move the layer inside a fixed mask.

Painting on a mask

Click the mask thumbnail so that it has a white border (it is now the target; clicking the layer thumbnail targets the pixels instead). Then:

  1. Press B for the Brush. Press D to reset the colors to black and white.
  2. Paint with black to hide, and white to reveal. Press X to swap the two colors.
  3. Use a soft round brush (low hardness) for blending, and a hard brush for crisp edges.
  4. Lower the brush Opacity or Flow to build up partial transparency.

Use the Gradient tool (G) with a black-to-white gradient on a mask to blend two photos smoothly: drag in the direction of the transition.

You can also paint gray. A 50% gray shows the layer at half strength, so you can fine-tune where an effect is strong.

Python Stand-in: what a mask value does to a pixel

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The formula is a simple weighted average: result = layer x mask + below x (1 - mask).

A gradient mask blends two images

A black-to-white gradient across a mask creates a smooth transition. Here is a one-row version:

Python Stand-in: a gradient mask blending two rows

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The result starts dark on the left (the layer below shows) and gets lighter on the right (the top layer shows through).

Editing and managing masks

  • Shift+click the mask thumbnail to disable it temporarily (a red X appears). Shift+click again to re-enable.
  • Alt+click the mask thumbnail to see the mask itself as a black and white image in the canvas; Alt+click again to return. This is the best way to spot gaps and halos.
  • Ctrl+I inverts the active mask.
  • Ctrl+click the mask thumbnail to load it as a selection.
  • Drag a mask to the trash to discard it. Photoshop asks whether to Apply (bake the mask into the pixels) or Delete. Apply only when you are finished.
  • Hold Alt and drag a mask from one layer to another to copy it. Drag without Alt to move it.
  • The Properties panel gives Density (how strong the mask is) and Feather (a non-destructive blur on the mask edges).

Mask vs. Eraser

The Eraser deletes pixels permanently. A mask hides them. Always prefer a mask because:

  • You can change your mind at any time.
  • You can paint soft, partial transparency.
  • You can reuse the mask as a selection.
  • It works on text, shapes, Smart Objects and adjustment layers alike.

Masks on groups and adjustment layers

Select a group and add a mask to hide or reveal several layers at once. Every adjustment layer you add (Curves, Hue/Saturation and so on) comes with a white mask built in, so painting black on it limits the adjustment to the area you want. Select a part of the photo first and click an adjustment icon, and the mask is created from the selection.

Density, feather and why edges matter

A hard mask edge looks cut out; a very soft one looks smudged. Match the edge to the content: hair needs wispy transitions, a product edge needs a clean, nearly hard edge with a tiny feather (0.5 to 1 px). You can zoom to 100% or 200% and check the edge against several backgrounds by placing different colors below.

Common problems

  • Painting does nothing: the layer thumbnail, not the mask, is selected. Click the mask.
  • Brush paints colors on the mask: the mask only accepts grays; check the foreground color is black or white.
  • Mask moves with the layer: the chain icon is linked. Unlink it if needed.
  • Halos: leftover edge pixels from the old background. Use Layer > Matting > Defringe or a smaller edge shift in Select and Mask (see the refine lesson).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a black area of a layer mask do?

    Black conceals and white reveals. Shades of gray give partial transparency.
  2. 2. How do you add a mask that starts fully hidden?

    Alt+click (Option+click) creates a black (Hide All) mask so you paint white to reveal.
  3. 3. A pixel is 200 on the layer and 40 below it, and the mask value is 128. What is the approximate result?

    128/255 is about 0.5, so the result is about 200 x 0.5 + 40 x 0.5 = 120.
  4. 4. How do you view the mask itself on the canvas?

    Alt+click shows the mask as a grayscale image so you can find holes and rough edges.

Summary

  • Masks use white to reveal, black to hide, and gray for partial visibility.
  • Paint masks with the Brush or Gradient tool; invert with Ctrl+I; disable with Shift+click.
  • Masks are non-destructive and reusable as selections; prefer them over the Eraser.
  • Adjustment layers and groups can have masks too.

Next: Clipping Masks, Vector Masks and Knockouts