Web

How to Justify Text in the WordPress Block Editor (Manually or with a Plugin)

Web · Published 2026-10-27

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.

  1. 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.
  2. Paste:
    .justify {
      text-align: justify;
      hyphens: auto;
    }
  3. In the post, select the Paragraph block, open the block settings sidebar, expand Advanced and type justify in 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:

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

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

Read next

More in Web