I want to erase part of a rectangle but it gets erased in the way shown in the right hand image:

Incorrect erasing of rectangle

I want to be like this:

Desired erasing of rectangle


I'm guessing you're using a stroke layer style on your shape in Photoshop.

If you use a Layer Mask directly on the layer that has the shape with the effect, it will create the result you see on your top image. It won't delete the stroke but create a new "path" for it to follow instead, the stroke will simply wrap that shape and still be visible.

But if you put that layer into a "layer group" and add that layer mask to that group instead, you'll get the result on your second image. It will erase/mask the stroke layer effect as well or any other layer style you used on the layers within that group. This can be useful for drop shadows too.

layer mask on a group


Should really consider using Shape instead with Fill and Stroke. Then when you use a Layer Mask to erase part of it the Stroke won't be affected. It will give you a better workflow for most things while keeping things higher quality and less destructive.

enter image description here


If using layer style effects to get the border (stroke in layer effects) then you want to toggle the "Layer Mask Hides Effects" checkbox under "Blending Options". enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.