Learn how to mask layers to hide and reveal parts of your composite

You can add a mask to a layer and use the mask to hide portions of the layer and reveal the layers below. Masking layers is a useful for combining multiple photos into a single image or for removing a person or an object from a photo.

About layer and vector masks

You can create two types of masks:

  • Layer masks are resolution-dependent bitmap images that are edited with the painting or selection tools.
  • Vector masks are resolution independent and are created with a pen or shape tool.

Layer and vector masks are nondestructive, which means you can go back and re‑edit the masks later without losing the pixels they hide. In the Layers panel, both the layer and vector masks appear as an additional thumbnail to the right of the layer thumbnail. For the layer mask, this thumbnail represents the grayscale channel that is created when you add the layer mask. The vector mask thumbnail represents a path that clips out the contents of the layer.

To create a layer or vector mask over the Background layer, first convert it to a regular layer (Layer > New > Layer from Background).

You can edit a layer mask to add or subtract from the masked region. A layer mask is a grayscale image. The areas you paint in black are hidden, the areas you paint in white are visible, and the areas you paint in shades of gray appear in various levels of transparency.

Masking layers
Mask layer: A. Layer mask thumbnail B. Vector mask thumbnail C. Vector Mask Link icon D. Add Mask
Edit mask
Edit layer mask: Background painted with black; description card painted with gray; basket painted with white

A vector mask creates a sharp-edged shape on a layer and is useful anytime you want to add a design element with clean and defined edges. After you create a layer with a vector mask, you can apply one or more layer styles to it, edit them if needed, and instantly have a usable button, panel, or other web-design element.

The Properties panel provides additional controls to adjust a mask. You can change the opacity of a mask to let more or less of the masked content show through, invert the mask, or refine the mask borders, as with a selection area.

Properties panel
Properties panel: A. Layer mask B. Vector mask

Add layer masks

When you add a layer mask, you can hide or show all of the layer, or base the mask on a selection or transparency. Later, you’ll paint on the mask to precisely hide portions of the layer, revealing the layers beneath.

Add a mask that shows or hides the entire layer

  1. Make sure that no part of your image is selected. Choose Select > Deselect.
  2. In the Layers panel, select the layer or group.
  3. Do one of the following:
    • To create a mask that reveals the entire layer, click the Add Layer Mask  button in the Layers panel, or choose Layer > Layer Mask > Reveal All.

    • To create a mask that hides the entire layer, Alt-click (Win) or Option-click (Mac) the Add Layer Mask button, or choose Layer > Layer Mask > Hide All.

Add a layer mask that hides part of a layer

  1. In the Layers panel, select the layer or group.
  2. Select the area in the image, and do one of the following:
    • Click the New Layer Mask button  in the Layers panel to create a mask that reveals the selection.
    • Alt-click (Win) or Option-click (Mac) the Add Layer Mask button in the Layers panel to create a mask that hides the selection.
    • Choose Layer > Layer Mask > Reveal Selection or Hide Selection.

To directly edit layer transparency, do the following and create a mask:

  1. In the Layers panel, select the layer.
  2. Choose Layer > Layer Mask > From Transparency.

Photoshop converts transparency into an opaque color, hidden by the newly created mask. The opaque color varies greatly, depending upon the filters and other processing previously applied to the layer. This technique is helpful for video and 3D workflows.

Apply a layer mask from another layer

Do one of the following:

  • To move the mask to another layer, drag the mask to the other layer.
  • To duplicate the mask, Alt-drag (Win) or Option-drag (Mac) the mask to the other layer.

Unlink layers and masks

By default, a layer or group is linked to its layer mask or vector mask, as indicated by the link icon  between the thumbnails in the Layers panel. The layer and its mask move together in the image when you move either one with the Move tool . Unlinking them lets you move them independently and shift the mask’s boundaries separately from the layer.

  • To unlink a layer from its mask, click the link icon in the Layers panel.

  • To reestablish the link between a layer and its mask, click between the layer and mask path thumbnails in the Layers panel.

Disable or enable a layer mask

Do one of the following:

  • Select the layer containing the layer mask you want to disable or enable, and click the Disable/Enable Mask button  in the Properties panel.

  • Shift-click the layer mask thumbnail in the Layers panel.

  • Select the layer containing the layer mask you want to disable or enable, and choose Layer > Layer Mask > Disable/Enable.

A red X appears over the mask thumbnail in the Layers panel when the mask is disabled, and the layer’s content appears without masking effects.

Apply or delete a layer mask

You can apply a layer mask to permanently delete the hidden portions of a layer [*]. Layer masks are stored as alpha channels, so applying and deleting layer masks can help reduce file size. You can also delete a layer mask without applying the changes.

Opomba:

[*] Pixels are hidden, not deleted when applying layer masks with discontiguous areas.

  1. In the Layers panel, select the layer containing the layer mask.
  2. Do one of the following:
    • To remove the layer mask after applying it permanently to the layer, click the Apply Mask icon  at the bottom of the Properties panel.
    • To remove the layer mask without applying it to the layer, click the Delete button at the bottom of the Properties panel, and then click Delete.

    You can also apply or delete layer masks using the Layer menu.

    Opomba:

    You cannot apply a layer mask permanently to a Smart Object layer when deleting the layer mask.

Select and display the layer mask channel

For easier editing of a layer mask, you can display the grayscale mask by itself or as a rubylith overlay on the layer.

  1. In the Layers panel, do one of the following:

    • Alt-click (Win) or Option-click (Mac) the layer mask thumbnail to view only the grayscale mask. To redisplay the layers, Alt-click or Option-click the layer mask thumbnail. Alternatively, click the eye icon  in the Properties panel.
    • Hold down Alt+Shift (Win) or Option+Shift (Mac), and click the layer mask thumbnail to view the mask on top of the layer in a Rubylith masking color. Hold down Alt+Shift or Option+Shift, and click the thumbnail again to turn off the color display.

Change the layer mask color or opacity

  1. Double-click the layer mask channel in the Channels panel.

  2. To choose a new mask color, in the Layer Mask Display Options dialog box, click the color swatch and choose a new color.
  3. To change the opacity, enter a value between 0% and 100%.

    Both the color and opacity settings affect only the appearance of the mask and have no effect on how underlying areas are protected. For example, you may want to change these settings to make the mask more easily visible against the colors in the image.

  4. Click OK.

Adjust mask opacity and edges

Use the Properties panel to adjust the opacity of a selected layer or vector mask. The Density slider controls mask opacity. Feather lets you soften mask edges.

Other options are specific to layer masks. The Invert option reverses masked and unmasked areas. The Mask Edge option gives you various controls to modify the mask edges, such as Smooth and Contract/Expand. For information on the Color Range option, see Create and confine adjustment and fill layers.

Change mask density

  1. In the Layers panel, select the layer containing the mask you want to edit.
  2. In the Layers panel, click the Mask thumbnail. A border appears around the thumbnail.

  3. In the Properties panel, drag the Density slider to adjust the mask opacity.

    At 100% density, the mask is opaque and blocks out any underlying area of the layer. As you lower the density, more of the area under the mask becomes visible.

Feather mask edges

  1. In the Layers panel, select the layer containing the mask you want to edit.
  2. In the Layers panel, click the Mask thumbnail. A border appears around the thumbnail.

  3. Drag the Feather slider to apply feathering to the mask edges.

    Feathering blurs the edges of the mask to create a softer transition between the masked and unmasked areas. Feathering is applied from the edges of the mask outward, within the range of pixels you set with the slider.

Refine mask edges

  1. In the Layers panel, select the layer containing the mask you want to edit.
  2. In the Layers panel, click the Mask thumbnail. A border appears around the thumbnail.

  3. Click Select and Mask in the options bar. You can modify mask edges with the options in the Select and Mask workspace and view the mask against different backgrounds. 

  4. Click OK in the Select and Mask workspace to apply your changes to the layer mask.