Boolean Operations

When the shape you need is not among the standard shapes you will have to create it yourself. The first impulse might be to to use Vector tool and draw the shape from scratch. However you will find that many times, a complex shape is easy to break down into the basic shapes. With boolean operations you can do exactly that; combine basic shapes to create more complex ones.


Sketch has dynamic boolean operations and before we can discuss those in more detail we have quickly revisit shapes. Most vector shapes in Sketch will consist of only one series of points, known as a path. However a shape can have as many subpaths as you want and the how the resulting shape will look depends on how these are combined.

When you perform a boolean operation in Sketch, it will add the topmost shape as a subpath of the second shape and use the particular boolean operation. Because boolean operations in Sketch are dynamic you can always adjust the subpaths just as you could for any other shape layer.

When editing a shape with subpaths, they can all be edited at once — simply enter the editing mode. New shape layers can be added whilst in the mode, and they’ll be added above the currently selected subpath with a Union operation.


There are four different boolean operations and you will choose one depending on the situation.

Boolean operations
  • Union: The result is a vector that is the sum of both vectors’ areas.
  • Subtract: The result is a vector where the area of the top shape is removed from the one under it.
  • Intersect: The result is a vector consisting of the parts where the original shapes overlapped.
  • Difference: The result is a vector that is exactly the part where they didn’t overlap. It’s the inverse of an intersect operation.

Each of the four boolean operations can also be accessed from the Touch Bar when multiple shape layers are selected, along with options to align them.

Boolean operations on the Touch Bar

To help better explain boolean operations, this video outlines the operations explained above:

Layer List

When you have a shape with multiple subpaths in your Canvas, take a look at the Layer List. Just like with normal group layers you will see a disclosure triangle on the left. If you click it, you will reveal a list of subpaths for your shape. The icon on the right will allow you pick a boolean operation for each subpath individually from the pop-up menu.

As the Layer List is ordered from bottom to top; the order of the subpaths is the same. The boolean operation you pick will combine the layer with the layer below. The result of that will be passed to the subpath above if there is any.

Boolean operations

You can add shape layers to an existing boolean operation by clicking-and-dragging into the list of of subpaths, as well as drawing a new shape with a subpath selected. This will automatically give the new sublayer a Union operation.

It is also possible to hide subpaths from a shape via the Layer List. When a subpath is hidden it will change the way the shape appears, much like deleting a subpath, but this behaviour is not destructive. Subpaths can be hidden by Contol-clicking it in the Layer List and choosing “Hide Layer” from the shortcut menu, as well as the Shift-Command-H keyboard shortcut. Showing the subpath again will remember what operation was applied to it before it was hidden.

Flattening Shapes

When you flatten a shape in Sketch, it will try to represent the multiple paths inside the shape as one path; it will, so to speak, ‘flatten’ the hierarchy. However there are many paths that can’t be flattened into one. A shape with a hole inside it will always have to be represented as two paths; one for outer path, and one for the inner path.

When Sketch cannot flatten a path it will warn when you try to do so. If you persist, the subpaths you had will be replaced by different subpaths.

If you’re used to other design tools, you may automatically look to flatten a path after you have applied a boolean operation. In Sketch there’s no need for that; you can apply as many boolean operations on top of one-another keeping each subpath independent and editable.