Set a custom template for a SharePoint library
Applies ToSharePoint Server Subscription Edition SharePoint Server Subscription Edition Central Administration SharePoint Server 2019 SharePoint Server 2019 Central Administration SharePoint Server 2016 SharePoint Server 2016 Central Administration SharePoint Server 2013 Enterprise SharePoint in Microsoft 365 Office for business Office 365 Small Business Microsoft 365 admin SharePoint Foundation 2013 SharePoint in Microsoft 365 Small Business SharePoint operated by 21Vianet

When you create a SharePoint document library, you can set a default file type to open when a new file is created (for example, you can set a PowerPoint file as the default file type to open). You can also customize the default file template for that library. For example, you can create a Word template with customized headers and footers, or other custom features, and make it the default template for that library. Then, when you or your users create a new file, it opens in the appropriate program with your customized features.

Note: You must have Full control permissions for the library to set up a template.

Set up a default file type when you are creating a library

To set a file type to open a blank file in the appropriate program, Follow these steps.

  1. Navigate to the site where you want to create your library.

  2. Select Settings Gear shaped settings button, and then select Add an App.

  3. Select Document Library.

  4. Select Advanced Options.

  5. Add a name, optional description, versioning, and if applicable, whether you want the library to receive email.

  6. Select the default application file format and version from the Document Template dropdown.

    Select a template

  7. Select Create.

Customize the default template for a document library

To customize the default template, follow these steps. There are two ways you can change the default template:

  • If your document or form library has a default file template for a program compatible with SharePoint, then you can edit the default template.

  • For other programs, you cannot directly edit the default template, but you can copy a new template file to the Forms folder of the library to specify a custom template.

Edit the default file template

  1. Navigate to the site where your library is located.

  2. In SharePoint Server, on the ribbon, select the Library tab, then select Library Settings.

    For SharePoint in Microsoft 365, select Settings Gear shaped settings button, and then select Library settings.

  3. In SharePoint Server, under General Settings, select Advanced settings.

    Click advanced settings from settings window

    ​​​​​​​For SharePoint in Microsoft 365, select More library settings. Then select Advanced settings.

  4. In the Document Template section, under the Template URL field, select Edit Template. One of the following happens:

    If your site is a part of a Microsoft 365 subscription, at this point, you may be prompted to enter your Microsoft 365 subscription username and password.

    • Document library    The template opens in an app that is compatible with SharePoint and that is associated with the file type of the current template. For example, Word opens if the default template is a Word template, or Excel opens if the default template is an Excel worksheet.

    • Form library    The template opens either in a program compatible with SharePoint, either an XML-based form design program, such as InfoPath, or an XML editor.

      Edit template

    Note: If people on your site already filled-out forms that were based on the original template, consider how any changes to the template may affect those forms. For example, adding a field that users are required to fill out may cause errors to appear in the original forms that were filled out before the field was added.

  5. Make the changes that you want, and then save the template. For SharePoint in Microsoft 365, save the template with a new filename. Close the program if you no longer need it open, or switch to your site.

    Note: For SharePoint in Microsoft 365, the custom template must have a different filename than the default. Use the client's Save As feature to save the file to the Forms folder with a new filename. For example, for Word, don't use the default filename template.dotx.

  6. Depending on your form design program, you may need to republish the template to the library on your site from your program.

  7. In your site, at the bottom of the Document or Form Library Advanced Settings page, and select OK.

Specify a custom file template

  1. Create and save your custom template in a program that is compatible with SharePoint. Make note of its location, and then switch to SharePoint.

    Note: If the default document template is named anything other than template.dotx, no default templates appear in the list or library.

  2. Navigate to the site containing the library for which you want to specify a custom template.Option 1: (From Modern UX of the Library) New > Add Template Add TemplateOption 2:

  3. For this step, you must use Internet Explorer. In SharePoint in Microsoft 365, on the top right, select All Documents, and then select View in File Explorer.

    For SharePoint Server, select the Library tab on the ribbon, and in the Connect & Export group, select Open with Explorer.

    Important: If File Explorer does not open or you see an error message, you may have to add your site as a Trusted site in your browser settings. For more info, see Open in Explorer or View with File Explorer in SharePoint.

  4. In File Explorer, browse to find the custom template that you created.

  5. Right-click the file, and on the shortcut menu, select Copy.

  6. Select the Back button until you return to the library, and then select the Forms folder to open it.

  7. Right-click in a blank area in the folder window, and on the shortcut menu, select Paste.

  8. Close File Explorer and return to site.

  9. On the left, select Site Contents.

  10. Find your document library under Contents, hover over the name, select the ellipses (...), and then select Settings.

    If you don't see these commands, you may be in classic SharePoint. In that case, go to your document library, and on the ribbon, select the Library tab, and then select Library Settings.

  11. Under General Settings, select Advanced settings.

  12. In the Document Template section, do one of the following:

    Document library    Enter the address of your custom template in the Template URL field. The location is the web address of the template on the site, relative to the name of the site. For example, if your template is called Watermark.dotx, and you add it to the Forms folder of the Shared Documents document library, you would enter the following:

    Shared Documents/Forms/Watermark.dotx

    Form Library    Enter the address of the custom template that you want to use in the Template URL field. The location is the web address of the template on the site, relative to the name of the site. For example, if your template is called Orders.xml, and you add it to the Forms folder of the Purchases form library, you would enter the following:

    Purchases/Forms/Orders.xsn

    Note: If the settings in the Document Template box are not available, an administrator may have set up multiple content types. To see whether multiple content types are enabled, verify that Yes is selected under Allow management of content types? in the Content Types section immediately above the Document Templates section. If it is, you must edit the template for the content type.

More information about file templates in a document or form library

Here are some tips and guidelines for creating and using templates.

The types of files you can or cannot store in a SharePoint library

Depending on the file you have in a library, you might encounter one of the following situations:

Files compatible with SharePoint technologies    For a user to create a file by using the New command in a document library, the file template must be created from a program that is compatible with SharePoint, such as Microsoft Office Word. When you create a new file in a form library, the default program can be an XML-based form design program that is compatible with SharePoint, such as Microsoft InfoPath.

Other program files    For most other programs, you can still store and manage the file in the library. But instead of directly creating the file from the document library, you can create the file in your program and then upload it to the library later.

Blocked program files    For security reasons, some program file types, such as .exe, are blocked from being stored in a library. For more info, see Types of files that cannot be added to a list or library.

The two types of libraries that use file templates

The two types of libraries that use templates are document and form libraries.

Document Libraries    You use a document library to store and manage many different file types, including documents, spreadsheets, presentations, text files, and other types of files. A document library is often the most common location on a site where you can create, collect, update, and manage files with team members and share with other colleagues throughout your business or enterprise. You can use a document library as a general-purpose file repository, or you can use it for a specific purpose. For example, a marketing team may have its own document library for planning materials, news releases, and publications.

Form Libraries    A form library provides a simple way for you to share and track XML-based forms that are used to gather information. For example, you can create a form library for your department’s expense report forms. The expense report form template is stored as the default file template in the form library. Each time someone creates an expense report, they open the template as a blank form, which contains the layout, fields, and calculations of the expense report. When someone fills out the form, the expense report data (and only the data) is saved as an XML file in the form library. By separating the data from the form, it’s much easier to process each expense report separately by other systems, merge the data, or export it for further processing and analysis.

Where the file templates are stored in the library

When a document or form library has a default file template, it is stored in the Forms folder of the library.

Open the library in File Explorer to see the Forms folder which contains the file template for the library.

Form folder for storing templates

By default, a document library has a file template, called template.dotx, but you can change this file if you need to. To specify a different template, you need to first create it in a program that is compatible with SharePoint, such as Word, and then save it to the Forms folder of a library. Then, from the library, you specify the address of the custom template.

By default, a form library comes with a placeholder file, called template.xml that you must replace with a form template that you create.

Creating a file template for a form library

To create or customize a template in a form library, you can use an XML-based form design program that is compatible with SharePoint, such as InfoPath. There can be additional advantages to using a form design program. For example, when you use InfoPath, you can do the following:

  • Create the form library and template directly from InfoPath.

  • Conveniently edit and re-publish the form template to the form library.

  • Merge the individual XML data files created from some form templates for further processing.

  • Promote the fields of XML data to library columns in the form library.

When a user creates a form, it opens by default in the form-editing program that is compatible with SharePoint on the user’s client computer. If no compatible program is installed, the form, if it is designed to open in the browser can open in the browser. If you want, you can specify that a form designed to open in a browser always opens in the browser. You can change the default behavior in the Opening Documents in the Browser setting in the advanced settings of the library.

Go to Settings, Library Settings

In SharePoint online, select Settings, and then select Library Settings.

List Settings on ribbon

In SharePoint server, select Library Settings on the Library tab in the ribbon

Click advanced settings from settings window

Settings for a document library.

Screenshot of the Advanced Settings page for a Document Library in SharePoint

Open documents in browser setting.

Using content types to set up document or form library templates

If multiple content types are enabled and templates are specified for those content types, the library uses the templates that are specified by the content types, and not the default file template. In this case, if you want to customize the templates for the library, you must change the content types. For more information on content types, see Introduction to content types and content type publishing

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.