How to Justify Text in the WordPress Block Editor (Manually or with a Plugin)
The WordPress block editor's Paragraph block offers left, center and right text alignment, but no justify option. To justify text anyway, add a CSS class to the block and a one-line rule to your site's CSS, apply the rule site-wide if every paragraph should be justified, or install (or write) a small plugin that adds a reusable "Justified" style to the Paragraph block. Before you do, consider readability: justified text on the web often creates uneven gaps between words.
Why the button is missing
Older versions of the classic editor had a justify button, but WordPress 4.7 removed it from the toolbar in 2016, and the block editor never added it to the core Paragraph block's alignment control. A common reason given is that browsers justify without good hyphenation by default, which produces "rivers" of white space, especially on narrow mobile screens. Text justified that way is harder to read for many people with dyslexia, and the W3C's accessibility guidance (WCAG success criterion 1.4.8, Visual Presentation) recommends that text not be justified. If you still need it, for a print-like layout or a client's style guide, the methods below work without hacks.
Method 1: a CSS class on selected paragraphs
This works on any WordPress site with no plugin.
- Add the CSS rule once. On a block theme, open Appearance › Editor › Styles, then Additional CSS from the Styles panel's options menu; on a classic theme, use Appearance › Customize › Additional CSS.
- Paste:
.justify { text-align: justify; hyphens: auto; } - In the post, select the Paragraph block, open the block settings sidebar, expand Advanced and type
justifyin Additional CSS class(es).
The paragraph is justified on the front end. In the editor itself it may still appear left-aligned, because Additional CSS is not always loaded inside the editing canvas; preview the post to check. hyphens: auto lets the browser break long words at the end of lines, which reduces the gaps. It relies on the page's language attribute, which WordPress sets from your site language.
To justify a whole section at once, wrap its paragraphs in a Group block, give the Group the class, and change the selector to .justify p.
Method 2: justify every paragraph site-wide
If all body text should be justified, target paragraphs inside post content rather than adding classes one by one:
.entry-content p,
.wp-block-post-content p {
text-align: justify;
hyphens: auto;
}
The selectors cover common classic themes (.entry-content) and block themes (.wp-block-post-content). A paragraph you explicitly set to center or right in the editor keeps its alignment, because WordPress adds a has-text-align-center or has-text-align-right class that you can exclude with :not([class*="has-text-align-"]) if your theme's specificity gets in the way.
Do not try to add style="text-align:justify" through "Edit as HTML" on a Paragraph block: the editor compares the saved markup with what the block would generate and flags the block as containing unexpected or invalid content.
Method 3: a tiny plugin that adds a "Justified" style
Block styles are the editor-native way to offer a visual variation. Once registered, "Justified" appears in the Styles panel of every Paragraph block, the editor previews it correctly, and your content stays valid. You can put this in a child theme's functions.php, but a small plugin survives theme changes. Create wp-content/plugins/justified-paragraph-style/justified-paragraph-style.php:
<?php
/**
* Plugin Name: Justified Paragraph Style
* Description: Adds a "Justified" style to the Paragraph block.
* Version: 1.0.0
* Requires at least: 6.3
* License: GPL-2.0-or-later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'init', function () {
register_block_style(
'core/paragraph',
array(
'name' => 'justified',
'label' => __( 'Justified', 'justified-paragraph-style' ),
'inline_style' => '.is-style-justified { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }',
)
);
} );
Activate it under Plugins. Then select a paragraph, open Styles in the block sidebar and choose Justified. WordPress adds the class is-style-justified to the paragraph and prints the inline CSS on pages that use it. The file passes php -l; the ABSPATH check stops it from being executed directly.
Why this beats a CSS class typed by hand: editors pick a named option instead of remembering a class, the rule lives in one place, and removing the plugin simply returns paragraphs to the default alignment without breaking any block.
Using a third-party plugin
Several plugins in the WordPress.org directory add a justify button to the block toolbar, or bring back classic-editor buttons. If you prefer one of these, check before installing:
- Maintenance: last update date and "tested up to" version in the plugin directory.
- How it stores the setting: plugins that add a block attribute or class are fine; plugins that inject inline styles can leave invalid blocks if you uninstall them later.
- Scope: a plugin that bundles dozens of unrelated features adds weight to every editor session for one button.
The general advice for choosing plugins carefully, covered in the WooCommerce coupon plugin roundup, applies here too: fewer, well-maintained plugins mean fewer conflicts.
Make justified text readable
- Turn on hyphenation with
hyphens: auto, as above. - Keep lines reasonably long. Justification works better with 60 to 75 characters per line. On narrow screens, consider switching back to left alignment with a media query, for example
@media (max-width: 600px) { .is-style-justified { text-align: left; } }. - Do not justify headings, captions, lists or short lines. The last line of each paragraph is left-aligned by default (
text-align-last: auto), which is what you want. - Test with real content on a phone, and with long words or URLs that cannot be hyphenated.
Summary
Core's Paragraph block only aligns left, center or right. Justify selected paragraphs with an Additional CSS class plus a CSS rule, all paragraphs with a site-wide selector, or offer editors a proper "Justified" block style with a few lines of PHP calling register_block_style. Add hyphens: auto, avoid editing block HTML by hand, and weigh the readability cost before justifying body text.
Sources
- WordPress Developer Resources, register_block_style() and the Block Styles API.
- WordPress.org Documentation, Paragraph block.
- W3C, Understanding Success Criterion 1.4.8: Visual Presentation.
WebWooCommerce coupons
How WooCommerce coupons work: discount types, restrictions, usage limits, WC_Coupon in PHP, URL coupons, common problems and when a coupon plugin helps.
WebBuilding a medical practice website
Accessibility, tracking pixels and HIPAA, safe forms, structured data and local search for a clinic site.
WebWhat is a CRUD application?
CRUD means Create, Read, Update, Delete. See how it maps to SQL and REST HTTP methods, with a runnable Python example, validation, soft deletes and idempotency.