# Master Slide

> Manage master slides in Python with Aspose.Slides: create, edit, clone, and format themes, backgrounds, placeholders to unify slides in PowerPoint and OpenDocument.

Source: https://docs.aspose.com/slides/python-net/examples/elements/master-slide/
Updated: 2026-08-05


Master slides form the top level of the slide inheritance hierarchy in PowerPoint. A **master slide** defines common design elements such as backgrounds, logos, and text formatting. **Layout slides** inherit from master slides, and **normal slides** inherit from layout slides.

This article demonstrates how to create, modify, and manage master slides using Aspose.Slides for Python via .NET.

## **Add a Master Slide**

This example shows how to create a new master slide by cloning the default one.

```py
import aspose.slides as slides

def add_master_slide():
    with slides.Presentation() as presentation:

        # Clone the default master slide.
        default_master_slide = presentation.masters[0]
        new_master = presentation.masters.add_clone(default_master_slide)

        presentation.save("master_slide.pptx", slides.export.SaveFormat.PPTX)
```

> 💡 **Tip 1:** Master slides provide a way to apply consistent branding or shared design elements across all slides. Any changes made to the master will automatically reflect on dependent layout and normal slides.

> 💡 **Tip 2:** Any shapes or formatting added to a master slide are inherited by layout slides and, in turn, all normal slides using those layouts.
> The image below illustrates how a text box added on a master slide is automatically rendered on the final slide.

![Master Inheritance Example](master-slide-banner.png)

## **Access a Master Slide**

You can access master slides using the `Presentation.masters` collection. Here’s how to retrieve and work with them:

```py
import aspose.slides as slides

def access_master_slide():
    with slides.Presentation("master_slide.pptx") as presentation:
        # Access the first master slide.
        first_master_slide = presentation.masters[0]
```

## **Remove a Master Slide**

Master slides can be removed either by index or by reference. A master slide that is still used by a layout slide or a normal slide cannot be removed — only unused master slides can. In the presentation saved above, the cloned master at index 1 is the unused one.

```py
import aspose.slides as slides

def remove_master_slide():
    with slides.Presentation("master_slide.pptx") as presentation:

        # Remove an unused master slide by index.
        presentation.masters.remove_at(1)

        # Or remove an unused master slide by reference.
        # unused_master_slide = presentation.masters[1]
        # presentation.masters.remove(unused_master_slide)

        presentation.save("master_slide_removed.pptx", slides.export.SaveFormat.PPTX)
```

## **Remove Unused Master Slides**

Some presentations contain master slides that are not in use. Removing these slides can help reduce file size.

```py
import aspose.slides as slides

def remove_unused_master_slides():
    with slides.Presentation("master_slide.pptx") as presentation:

        # Remove all unused master slides (even those marked as Preserve).
        presentation.masters.remove_unused(True)

        presentation.save("master_slides_removed.pptx", slides.export.SaveFormat.PPTX)
```

> ⚙️ **Tip:** Use `remove_unused(True)` to clean up unused master slides and minimize the presentation size.



## Related articles

- [Layout Slide](https://docs.aspose.com/slides/python-net/examples/elements/layout-slide/)
- [Manage Presentation Slide Masters in Python](https://docs.aspose.com/slides/python-net/slide-master/)
- [Slide](https://docs.aspose.com/slides/python-net/examples/elements/slide/)