How to Remove the Background From a Portrait in Photoshop

To remove the background from a portrait in Photoshop, let the automatic subject selection make the first outline, refine the hair and edges in the Select and Mask workspace, and output the result as a layer mask instead of deleting anything. Then clean up colour fringes, check the edge against both a dark and a light backdrop, and either add a matching background or export a PNG with transparency.

This tutorial covers the whole job in order: the selection, the edge, the mask, the fringe, a believable replacement background and the export. How masks behave in general is explained in layers and masks in Photoshop, and how to replace the background of a photo is a shorter version of the swap itself. Tool names here are the stable ones. Menus, panels and buttons move between versions, so search for a tool by name if it is not where this page says.

Before you select: judge how hard the cutout will be

Three things decide how difficult a cutout will be.

  • Contrast along the outline. Dark hair on a pale wall separates easily. Dark hair in front of dark foliage does not, because the software (and your eye) cannot tell where one ends and the other begins.
  • How sharp the edge is. A subject in crisp focus has a clean outline. Shoulders that fall outside the depth of field, or a hand blurred by movement, have a wide soft edge that needs a soft mask to match.
  • How busy the background is. A plain or strongly blurred background gives clean results. A detailed, sharp background leaves bits of itself between strands of hair.

If you are shooting the portrait yourself with a cutout in mind, make it easy: a plain backdrop that contrasts with the hair and clothes, the subject a couple of metres in front of it so that little of its colour reflects back onto them, and enough light on the hair to separate it. Lighting portraits for a real-looking composite covers matching the light to a background you already have.

Before any selection, duplicate the photo layer or convert it to an ordinary layer, so the original pixels stay untouched underneath.

Automatic subject selection as the first pass

Photoshop offers several automatic routes to the same starting point. Use whichever your version has.

  • Select Subject. A command in the Select menu, and a button in the options bar when a selection tool is active. It analyses the picture and selects the main subject in one step.
  • Object Selection tool. Drag a rough rectangle or lasso around the person and it finds the object inside. Useful when there are several people and you want one.
  • Quick Selection tool. A brush that grows a selection outward to the nearest edges as you paint. Slower, but you control what is included.
  • A one-step remove background command. Some versions offer this as a quick action. It runs the subject selection and applies it as a layer mask for you.

Treat the result as a draft. Automatic selection is good at the big shape and unreliable in predictable places, so check these every time:

  • Enclosed gaps. The triangle between an arm and the body, the space between fingers, the gap between neck and hair. They are often left filled with background.
  • Low-contrast stretches. Wherever subject and background are similar in tone and colour, the outline wanders.
  • Thin and semi-transparent things. Glasses frames, earrings, loose strands of hair, veils and sheer fabric.

Fix the large errors now with the Quick Selection tool or the Lasso: add to the selection with one modifier key and subtract with the other (the options bar shows both modes as buttons). Leave hair and soft edges for the next stage. For hard-edged shapes, see how to use the lasso tool.

A pale stainless steel statue of a woman with braided hair and an outstretched arm, wrapped in a shell-like cloak with blue panels, against a blue sky with white clouds
Photo: Dignity Statue by Duncan Rawlinson. 50mm, f/8, 1/160, ISO 160. Where the pale statue crosses white cloud the edge has almost no contrast, which is where automatic subject selection goes wrong and needs correcting by hand; against the blue sky the same edge is easy.

Refining edges and hair in Select and Mask

With the selection active, open the Select and Mask workspace (in the Select menu, or from a button in the options bar of any selection tool). It replaces the image with a preview of the cutout and collects the edge tools in one place.

Pick a view that shows the problem

The view mode decides what you can see. Use On Black to check light hair and pale edges, On White to check dark hair, and Overlay to see what is left out. The Black and White view shows the mask itself, which is the quickest way to find holes and stray specks. Switch between at least two views before accepting any edge. An edge that looks perfect on white can show a bright halo on black.

Paint the hair with the Refine Edge Brush

The Refine Edge Brush tool tells Photoshop where the outline is uncertain. Paint it over the fringe of the hair, covering the zone where strands and background mix, and the software works out strand by strand what belongs to the subject. Keep the brush on the boundary only. Painting it over the solid part of the hair or over the face makes those areas partly transparent.

The Radius slider under Edge Detection does the same thing along the whole outline at once. A radius of a pixel or two suits a sharp outline. Larger values suit soft, fuzzy outlines.

Use the global sliders lightly

Slider What it does When to use it
Smooth Evens out a jagged, bumpy outline Small amounts on clothing and skin edges; too much rounds off corners and fingers
Feather Blurs the whole edge by a set amount Half a pixel to a pixel, to match the natural softness of the photo
Contrast Hardens a soft edge After feathering, to tighten an edge that has gone mushy
Shift Edge Moves the outline inward (negative) or outward (positive) A small negative value to cut off a thin rim of old background

These sliders act on the whole outline, hair included, so strong settings that tidy the jacket will also eat the fine strands. Keep them small here and fix individual stretches by painting on the mask afterwards.

A red fox lying in short green grass and looking toward the camera, with soft out-of-focus grass in front of and behind it
Photo: Red Fox Resting in Freshly Mown Grass by Duncan Rawlinson. 200mm, f/2.8, 1/640, ISO 800. Fur is the same problem as hair: fine strands along the ears and back overlap the background, and light bounced off the grass tints the lower edges green, which shows as a fringe once the background is changed.

When hair will not separate

Dark hair on a dark, detailed background sometimes cannot be extracted strand by strand, whatever the tool. Accept a slightly simplified, soft hair outline instead of a ragged one with background trapped in it. On the finished mask you can then paint a few fine strands back in with a one or two pixel brush, following the direction the real hair falls.

Output to a layer mask, not a deletion

At the bottom of the workspace, the output setting decides what you get back. Choose a layer mask (or a new layer with a layer mask). Do not output a selection and press delete.

A mask hides the background without removing it. White areas of the mask show the layer, black areas hide it and grey areas are partly transparent. Every decision stays reversible: paint white on the mask and the hidden pixels return. Deleting pixels makes every edge mistake permanent the moment you save. That is the core idea of non-destructive editing.

Working on the mask afterwards:

  • View the mask alone. Alt or Option-click its thumbnail to see it as a black and white image. Grey smudges in the white area are holes in the subject. Grey smudges in the black area are leftover background.
  • Paint corrections. Black hides, white reveals. Match the brush hardness to the edge: fairly hard for a jacket shoulder, soft for an out-of-focus arm.
  • Use a check layer. Put a solid colour fill layer under the portrait and flip it between a dark and a light colour, then something saturated such as red. Each one reveals a different kind of leftover.
  • Tighten the whole mask if a rim remains. Reopen Select and Mask on the mask and shift the edge inward slightly, or contract the mask by a pixel. The mask’s Feather setting in the Properties panel softens it without changing the mask pixels.

Fixing colour fringes and halos

The pixels along an outline are a mixture of subject and old background, and light from the background also reflects onto skin and hair. Put the cutout on a different background and that leftover colour shows as a rim: blue from a sky, green from grass or foliage, white or grey from a studio wall. There are four ways to deal with it, from quickest to most controlled.

  1. Decontaminate Colors. A checkbox in the Select and Mask output settings. It replaces the colour of edge pixels with the colour of the nearby subject. It changes pixels, so Photoshop outputs the result to a new layer instead of the original. It works well on hair against a plain coloured backdrop and can smear on complex edges, so compare with it on and off.
  2. Move the edge inward. A small negative Shift Edge value, or a one pixel contraction of the mask, cuts the contaminated rim off. Good for clothing and skin. Poor for hair, which simply gets thinner.
  3. Paint the right colour onto the fringe. Add an empty layer above the portrait, clip it to the portrait layer so it only affects the subject, and set its blend mode to Color. Sample a nearby hair colour and paint along the fringed strands with a soft brush. The strands keep their brightness and detail and lose the wrong colour. Photoshop blend modes explains why Color mode leaves the tones alone.
  4. Desaturate one colour at the edge. A Hue/Saturation adjustment layer clipped to the portrait, set to the fringe colour only (greens, say), with saturation reduced and a mask restricting it to the outline. This suits spill on skin and pale clothing.

A light halo around the whole subject on a dark background usually means the mask is slightly too large. A dark line around the subject on a light background means the same thing with a dark original backdrop. Photoshop’s Matting commands in the Layer menu (Defringe, and removing a black or white matte) target exactly this on a layer whose background has already been deleted, which is one more reason they are a fallback: the mask-based fixes above stay editable. General cast correction is covered in color cast.

A great horned owl perched on a thick black cable against a clear blue sky, with yellow autumn leaves on thin branches around it
Photo: Great Horned Owl On A Wire by Duncan Rawlinson. 200mm, f/5.6, 1/1500, ISO 400. Fine ear tufts and feather edges against a saturated blue sky pick up a blue rim, the colour fringe that shows as soon as the bird is moved onto a different background.

Adding a new background believably

A clean mask is half the job. The eye rejects a composite when the subject and the background disagree about light, colour, sharpness or viewpoint. Place the new background on a layer below the portrait and work through these in order.

Light direction and quality

Find the main light on the face: which side is brighter, and where the nose shadow falls. Then find it in the background from its shadows and bright surfaces. If they disagree, flip the background horizontally (or the portrait, if nothing in it reveals the flip, such as text or a wedding ring). Quality matters as much as direction. A face lit by soft window light does not belong in a scene with hard midday shadows. Direction of light shows how to read both.

Colour and contrast

Clip a Curves adjustment layer to the portrait and adjust the red, green and blue curves until the subject’s neutral tones (whites of the eyes, a white collar, grey hair) share the colour of neutral tones in the background. Then compare the darkest shadows. If the background’s deepest tone is a hazy dark grey and the subject’s is solid black, lift the bottom of the subject’s curve to match.

Blur, scale and viewpoint

  • Blur. A portrait shot at a wide aperture has a soft background, so a new background that is sharp from front to back looks pasted in. Blur it until its softness is plausible for the distance, as described in what is bokeh. If the subject’s shoulders are slightly soft, the background must be softer still.
  • Scale. Doors, chairs and other people in the background set the size of everything. Scale the subject to them.
  • Horizon and camera height. A portrait shot from eye level has the horizon at about the height of the subject’s eyes. Position the background so that its horizon line sits where the original camera height puts it.
  • Grain. The portrait and the background rarely have the same noise. A fine layer of grain over the whole finished image gives both the same texture. See how to add film grain to digital photos.

Grounding the subject

If the body touches anything in the scene (a floor, a wall, a seat), it needs a shadow there. Paint a soft, dark shadow on a layer between the background and the subject, darkest and sharpest right at the point of contact and fading as it moves away, on the side opposite the light. How to make fake shadows in Photoshop goes further. For a head-and-shoulders portrait with no contact point, a slight darkening of the background behind the subject is often enough to seat it.

For a plain studio-style result, skip the photograph and use a solid colour or gradient fill layer as the background: see how to add colour to the background of a portrait.

Exporting with transparency

If the cutout is going onto a web page, into a design or onto a product listing, export it with the background transparent. Hide or delete every layer below the portrait so the checkerboard pattern shows around the subject. The checkerboard is Photoshop’s way of displaying transparency and is not part of the picture.

Format Keeps transparency? Use it for
PSD Yes, with layers and the editable mask Your master file. Always save one.
TIFF Yes, and can keep layers Handing off to print and layout software
PNG Yes, with smooth partial transparency Web, presentations and design tools. Files are large for photographs.
WebP Yes Web pages where file size matters and the destination accepts it
JPEG No. Transparent areas are filled with a solid colour, usually white. Only when the cutout already sits on its final background

Use the export command in the File menu, choose PNG and make sure the transparency option is ticked. Before exporting, the Trim command in the Image menu can crop away empty transparent margins so the file is no larger than the subject. Image file formats explained compares the formats in detail, and exporting photos covers sizing and colour space.

Common mistakes

Deleting the background. The first edge error you notice later cannot be repaired. Fix: always output to a layer mask and keep the layered master.

Checking the edge on one backdrop only. A cutout judged on white hides light halos, and one judged on black hides dark ones. Fix: flip a colour fill layer between dark, light and a saturated colour before calling it finished.

One edge setting for the whole outline. Feather that suits hair makes a jacket look fuzzy, and contrast that suits the jacket strips the hair. Fix: keep global sliders low and finish each stretch by painting on the mask with a brush of matching hardness.

Ignoring the colour rim. Green or blue edges give the composite away at a glance. Fix: decontaminate, contract or repaint the fringe as described above.

A sharp background behind a shallow-focus portrait. Fix: blur the background until it is softer than the softest part of the subject.

Saving a transparent cutout as JPEG. The transparency is replaced with a solid fill. Fix: export PNG, WebP or TIFF.

Try this: one portrait, three backdrops

Allow 20 minutes and use a portrait with some loose hair against a fairly plain background.

  1. Duplicate the layer, run the automatic subject selection and note three places where it is wrong.
  2. Open Select and Mask, set the view to On Black, and paint the Refine Edge Brush around the hair only. Switch to On White and look again.
  3. Output to a layer mask. Add a solid colour fill layer underneath.
  4. Set the fill to black, then white, then bright red. At each colour, zoom to 100% and repair what you see by painting on the mask.
  5. Find any colour fringe in the hair and remove it with a clipped layer in Color mode.
  6. Export a PNG with transparency.

Frequently asked questions

What is the fastest way to remove a background in Photoshop?

Run the automatic subject selection, or the one-step remove background command if your version has it, and apply the result as a layer mask. On a sharp subject with a plain background that takes seconds. Hair, soft edges and busy backgrounds still need a few minutes in Select and Mask.

How do you cut out hair cleanly?

Paint the Refine Edge Brush along the boundary of the hair in Select and Mask, check the result on both black and white, then remove any colour fringe. Where hair and background are too similar to separate, simplify the outline and paint in a few fine strands by hand.

Why is there a white or coloured outline around my cutout?

Edge pixels still contain some of the old background. Move the mask edge inward by about a pixel, use Decontaminate Colors, or repaint the rim on a clipped layer in Color mode. Always check the cutout against a backdrop that contrasts with the fringe.

Should you erase the background or use a mask?

Use a mask. It hides the background without destroying it, so every part of the edge can be corrected later with a black or white brush.

Which file format keeps a transparent background?

PNG is the usual choice for web and design use. WebP and TIFF also keep transparency, and PSD keeps the layers and mask as well. JPEG cannot store transparency and fills the empty area with a solid colour.

Related guides