How to Center a Title in WordPress (Site, Page or Post)
To center a title in WordPress, select the block that displays it and choose center text alignment. For a title supplied by your theme, edit its template or use the theme’s title settings. First identify whether you mean the site name, the page’s main title, or a heading inside the page: they are different elements.
Find the title you want to center
Site title: your website’s name, commonly displayed in the header. Page or post title: the title of the current article or page. Content heading: an H2 or H3 you inserted within the article. SEO title: the text used in the HTML title element and potentially in search results; CSS on your site cannot control how Google aligns its search results.
Changing the title text itself is different from aligning it. If you only want to center the site name, leave its wording alone. Editing the Site Title block’s text can change the site name elsewhere too, as explained in the official Site Title block documentation.
Center the site title in a block theme
- Open Appearance → Editor and locate the Header template part used by the page you are checking. Depending on the editor version, template parts may be listed within Patterns.
- Open the Header and use List View to select Site Title. Select the text block rather than the entire header.
- Open the text alignment control in the block toolbar and choose center. If the control is unavailable in your setup, use the targeted CSS method below.
- Preview the header and review which template part will be saved. Check the homepage and another page that uses the same header.
Center alignment places the text in the middle of its own box. A box in the left column of a header is still in the left column. If you want the title in the middle of the full header, inspect the parent Group, Row, or Columns layout. A logo or menu beside it may occupy space that prevents geometric centering across the page.
Center a page or post title in a block theme
Open the template that supplies the page’s title, such as the relevant page or single-post template. In List View, select the Title block, formerly called Post Title. Use its center text alignment control when available, or add the class described below. The Title block displays a post or page’s title dynamically.
Check the template’s scope before saving: editing a shared template can change the title alignment on every page that uses it. For a one-page design, use a separate template assigned to that page if your theme supports this, or a page-specific CSS selector in a classic theme. Do not add a second main title in the article to cover up the original.
A Title block inside a Query Loop controls titles in that list of posts. It is not necessarily the block that controls the title on an individual article. Open the public page you actually want to change and confirm its template.
Center a heading inside the content
Edit the page or post, select the Heading block, and choose center text alignment in the toolbar. Keep its heading level appropriate to the content structure. If you also need to resize it, use Typography rather than changing H2 to another level just for appearance. See our font-size guide.
The same idea works for tables. Click a cell in a Table block and use the “Change column alignment” button to center that column. See how to create a table in WordPress for the other table settings.
If you use a page builder, select the heading or title element inside the builder that already controls this page. Use its alignment control and review its mobile settings. Installing a new builder just to center a title is unnecessary.
Use targeted CSS when the control is missing
For a block with an Advanced settings panel, add htwp-centered-title under Additional CSS class(es), without the leading dot. Add this CSS in your theme’s supported custom CSS area:
.htwp-centered-title {
text-align: center;
}
This rule centers inline text inside the title’s box. It does not move the containing column or override every possible inline style. If you also need a narrower text measure centered within a normal block container, use this variant:
.htwp-centered-title {
text-align: center;
max-width: 40rem;
margin-inline: auto;
}
The maximum width caps the title’s box, while automatic inline margins can center that box when the containing layout allows it. A narrow parent or a flex/grid arrangement may still need its own layout settings. The text-align reference and margin-inline reference explain these separate effects.
Center a title in a classic theme
Start with your theme’s title or header alignment options, often under Appearance → Customize. If it offers no suitable control, inspect the title on the public page using your browser’s element picker. Use the class or ID actually present in your theme.
For example, only if the body has page-id-123 and the title has entry-title, this rule affects that page’s title:
.page-id-123 .entry-title {
text-align: center;
}
Replace the example ID and class with values from your page. Themes do not all use .entry-title or .site-title. Add the rule to a supported custom CSS area, commonly Customize → Additional CSS, rather than editing the parent theme’s stylesheet. Keep the original settings so the edit is easy to undo.
If the title still looks off-center
The editor changes but the page does not: confirm you saved the correct template, then check for an older cached page. The text is centered in the wrong place: select the parent container and inspect its width, columns, padding, and justification. The CSS has no effect: verify the selector and any overriding rule before reaching for !important.
Test a long title on a narrow screen. Avoid fixed heights that cut off a second or third line, and check that the header’s menu still works. If you are rearranging a shared header, first try the change on a staging site. Our menu-copying guide helps when that redesign needs an independently editable menu.
If the title sits inside a cramped sidebar, check the widget container width before adjusting alignment. Use text-size controls separately from title positioning.
If the alignment problem comes from conflicting theme or page-builder styles and you would like help diagnosing it, see my WordPress services. Send an example page and the theme or builder you are using so I can confirm whether the repair fits.

