Publish Helper logo

Clean HTML for WordPress

WordPress runs 43% of the web, and its Gutenberg block editor is where pasted document HTML goes wrong. A Custom HTML block keeps your markup as written, while a paragraph block re-interprets it as block attributes — and a Docs paste arrives with font-size and class attributes already attached. This page covers what Gutenberg and wp_kses_post() do to a paste, and the one workflow that survives both.

I

HTML Issues with WordPress

WordPress's Gutenberg editor strips some inline styles on paste but retains others inconsistently. Block editor paragraphs may inherit font-family and font-size declarations from Google Docs, overriding your theme styles. The Classic Editor is even less forgiving — it preserves nearly all pasted inline styles.

II

What WordPress Actually Does to Pasted HTML

Editor:Gutenberg block editor (and the Classic Editor on older installs)

Pasting into a Paragraph block

Gutenberg turns the HTML into block attributes. A Docs <p style="font-size:11pt"> arrives as a paragraph that still carries that font size, and a <span> with italic style survives as an inline span rather than an <em>.

Pasting into a Custom HTML block

The block stores your markup as one HTML string and prints it unchanged. Nothing is re-parsed, so block-validation warnings and re-added styles do not happen here.

Saving the post

wp_kses_post() filters the saved content. Standard tags and style attributes survive, but <style> blocks, <script>, <iframe> and event handlers are removed — so a custom font declaration cannot travel with the paste.

Switching to the Classic Editor

The old TinyMCE editor keeps MsoNormal classes, mso- properties and inline fonts almost intact, because it has no block model to normalise them into.

III

How to Paste Clean HTML into WordPress

  1. 1.

    Write the draft anywhere, then select and copy the passage you want to publish

  2. 2.

    Paste it into Publish Helper, enable Remove inline styles and Remove classes, and click Clean HTML

  3. 3.

    In the WordPress editor, add a Custom HTML block (or open Code Editor from the three-dot menu)

  4. 4.

    Paste the cleaned markup into that block and switch back to the visual editor

  5. 5.

    Preview the post on mobile as well — block-level tables and long lists are where theme overrides fail

IV

WordPress Tips

V

WordPress Paste Problems, and the Fix for Each

The pasted text keeps its old font and size, ignoring the theme

An inline font-family or font-size on the paragraph out-ranks your theme's class rule. Strip the styles in Publish Helper, then paste into a Custom HTML block instead of a Paragraph block.

Gutenberg shows “This block contains unexpected or invalid content”

The editor compared the block's saved HTML with what it expected and the pasted markup did not match. Choose “Convert to HTML” or paste into a Custom HTML block, which never runs block validation.

Huge gaps appear between paragraphs

Google Docs leaves empty <p> elements and trailing <br> tags behind. Turn on Remove spacer paragraphs and Remove empty tags before copying the output.

Gutenberg is a block editor, not a rich-text field, and that is the real source of most WordPress paste problems. Every block keeps its own copy of the HTML plus a set of attributes (alignment, font size preset, colour) derived when the block was created. When the paste does not match the block's expectations, WordPress either silently converts it into a “Classic” block — which then holds the Docs markup almost verbatim, inline styles and c1/c3 classes included — or raises a validation warning. The reliable route is a Custom HTML block: it is a deliberate escape hatch that stores the string you give it.

The second half of the problem is wp_kses_post(), the filter WordPress runs on post content at save time. It allows a wide list of tags common to blog posts, keeps style attributes on many of them, and removes <style> blocks, scripts, iframes and inline event handlers. In practice that means Google Docs typography often survives the save, while a <style> block that tried to define a heading font does not. Cleaning before the paste sidesteps both halves: nothing left to filter, nothing left to override the theme.

VI

Tools for This Workflow

VII

Frequently Asked Questions

Does a Custom HTML block work on WordPress.com as well as self-hosted WordPress?

+

Yes. The Custom HTML block is part of Gutenberg core, so WordPress.com and self-hosted installs both accept it. On WordPress.com the block is also the only place where some tags, such as tables, are preserved exactly as pasted.

Why does my table look fine in the editor but break on the published page?

+

Tables are usually saved as a Classic block. A table with width attributes copied from Word overflows a narrow theme column on small screens. Strip the width attributes and cell styles in Publish Helper, and let the theme's table CSS handle sizing.

Why does my Google Docs paste look different in WordPress?

+

Google Docs inline styles (font-size, font-family, color) override your WordPress theme styles. Clean the HTML with Publish Helper first to remove these inline styles so your theme typography applies correctly.

Should I use the Visual Editor or Code Editor?

+

For clean HTML from Publish Helper, use a Custom HTML block or the Code Editor. The Visual Editor may re-introduce formatting you just removed.

Does this work with WordPress.com?

+

Yes. WordPress.com supports Custom HTML blocks just like self-hosted WordPress. The workflow is identical: clean in Publish Helper, paste into a Custom HTML block.

Last updated: May 2026|Built by content editors for content editors|Used by 10,000+ bloggers
Related Tools & Guides

Ready to clean your HTML?

Open Publish Helper

Last updated: March 2026

Changelog

v3.5.02026-11-08
  • NewWarm dark mode — switch it from the header; your choice is remembered
  • ImprovedWith no saved choice, the theme follows your system's light/dark preference from the first frame, without a flash
  • FixThe browser's theme colour now always matches the current theme — one meta tag instead of two
  • FixDark mode rebuilt on the current page architecture, so it applies consistently to every page
  • ImprovedEvery pull request now runs type checks, unit tests and a production build automatically — same features, steadier quality
v3.4.02026-11-05
  • New4 new platform guides — ChatGPT, PDF, beehiiv and Mailchimp
  • ImprovedAll 16 platform guides rewritten with platform-specific content; Keyword Density, Readability and HTML Diff guides expanded ~3×
  • FixAd banners no longer push content down the page — stable layout from first paint
  • FixStructured Data tool's date field no longer stuck at the build date
  • ImprovedMobile: compact cookie banner, larger touch targets, AA-compliant text contrast
  • ImprovedRelated-page links now stay in your language
  • FixInternal fixes — sitemap coverage, canonical URLs, security headers and legacy URL handling
v3.3.12026-06-17
  • FixSlug generator updated to latest AI model for better reliability
  • FixHeading conversion now supports U+FE30 colon separator (︰) used in vertical CJK text
  • FixHeading conversion no longer includes leading &nbsp; in the extracted title
  • FixOG image generator now wraps long CJK text and prevents overflow with ellipsis truncation
  • ImprovedUpdated sharp to 0.35.1 for better image processing
v3.3.02026-05-30
  • FixSEO & a11y: <html lang> attribute, theme-color meta, OG image alt text i18n
  • FixGA scripts properly removed on consent decline
  • FixContent Stats i18n + link count regex fix
  • FixTool page section numbering corrected (all 14 pages)
  • ImprovedSimplified cleanup options — removed 10 checkboxes Tiptap already handles, kept only 4 useful ones
  • ImprovedAuto-clean only triggers on paste, not every content change
v3.2.12026-05-26
  • FixHeading converter now correctly splits paragraphs containing MULTIPLE heading-strong elements
  • FixHeading converter now places extracted headings BEFORE their body paragraph instead of after
  • FixEditor toolbar no longer causes React hydration mismatch on first paint
  • FixMissing @tiptap/extension-drag-handle-react dependency added
v3.2.02026-05-23
  • New6 new SEO content editing tools — Case Converter, Text Extractor, Text Diff Checker, Keyword Density Analyzer, SERP Preview Generator, Readability Checker
  • NewHeading dropdown expanded to H5-H6 (was H1-H4 only)
  • NewTable toolbar — insert/delete rows & columns, merge/split cells, toggle header row
  • NewDrag Handle React — drag and reorder blocks in the editor
  • NewCase Converter — 11 case formats including camelCase, PascalCase, snake_case, kebab-case
  • ImprovedSERP Preview — accurate Google-style preview with desktop/mobile views
  • ImprovedText Diff — word-level highlighting within changed lines
  • ImprovedAll new tools linked from the main page TOOLS & GUIDES section and related pages
  • Improvedzh-TW FAQ alignment fixed across all tools
v3.1.12026-05-23
  • FixEditor draft restore — saved content now correctly loads into the Tiptap editor on page reload
  • ImprovedDependency updates for better performance and stability
v3.1.02026-05-14
  • NewBold List Labels — auto-bold label prefixes (e.g. "Name: John" → "<strong>Name:</strong> John") in list items
  • NewFormatting Add-ons group — Heading Conversion, CJK Auto-Spacing, and Bold List Labels now grouped under a collapsible section
  • FixCJK Auto-Spacing now works across HTML tag boundaries
v3.0.22026-05-08
  • FixHeading converter now correctly splits multiple H2/H3 prefixes inside a single <strong> element separated by <br> tags
v3.0.12026-05-07
  • FixHTML cleaner now properly strips orphaned <strong><br><br></strong> tags left behind by Google Docs
  • FixHeading converter now detects H2/H3 prefixes inside <strong> tags embedded at the end of a paragraph
  • FixTrailing <br> tags at the end of paragraphs are now stripped — no more pointless line breaks before headings
v3.0.02026-05-03
  • NewHTML Diff Viewer — compare before and after HTML with a visual diff (green/red)
  • NewContent Stats Calculator — word count, reading time, heading, image, and link counts
  • NewHTML Accessibility Checker — detect missing alt text, empty headings, skipped levels, and more
  • NewOG Image Generator — create 1200×630 social share images from your blog post title
  • NewMarkdown ↔ HTML Converter — bidirectional conversion between Markdown and HTML
  • NewTable of Contents Generator — auto-generate nested TOC from heading tags in HTML or Markdown
  • NewJSON-LD Structured Data Builder — generate Article, BlogPosting, and FAQPage schema markup
  • NewAuto-clean on paste — optional toggle that auto-triggers cleanup when content is pasted
  • NewTable cleanup options — strip cell widths and remove empty table cells
  • NewAuto-save draft — content is saved to localStorage and restored on accidental refresh
  • NewAll new tools linked from the main page TOOLS & GUIDES section and related pages
v2.4.12026-04-27
  • NewParagraph option added to heading dropdown — convert headings back to normal text
  • FixH1–H6 heading prefixes now convert correctly even when pasted with leading line breaks
  • FixFixed page crash on load — cookie consent now renders reliably
  • ImprovedDependency updates for better performance and stability
v2.4.02026-04-17
  • NewClear button — quickly wipe all editor content and reset the HTML panel from the left panel header
  • FixEmpty <p></p> placeholder no longer appears in the HTML panel after clearing the editor
  • NewImage insert via URL — paste any image URL into the editor with a new toolbar popover
v2.3.22026-04-14
  • FixHeading conversion rewritten with DOM parsing — now works with any wrapper tag, split headings, and safely preserves <li> inside lists
  • FixEmpty heading tags left behind by Google Docs are now automatically removed
v2.3.12026-03-25
  • FixHeading conversion now handles spaces before the colon (e.g. "H2 : Title")
  • FixRight-to-left content (Arabic, Hebrew) no longer inverts embedded English text in the editor
  • FixSpacer paragraphs (&nbsp;) are now preserved in the HTML output instead of being stripped
v2.3.02026-03-20
  • NewCJK auto-spacing — automatically insert spaces between CJK characters and English letters or numbers (powered by pangu.js)
  • NewStandalone CJK Auto-Spacing tool page with before/after examples, FAQ, and SEO-optimized bilingual content
  • NewChinese UI text auto-spacing — zh-TW interface text now has proper CJK–Latin spacing
  • FixMobile toolbar no longer floats and follows scrolling — stays pinned at the bottom of the editor
  • FixMobile toolbar buttons now scroll horizontally instead of overflowing
  • FixFind & Replace inputs no longer break out of the container on narrow screens
v2.2.12026-03-20
  • FixHeading conversion now uses the text prefix (e.g. H3:) to set the heading level, even when the content is already inside a different heading tag
v2.2.02026-03-18
  • NewAI-Powered Title to SEO Slug — Convert blog titles in any language to SEO-friendly English slugs in under 10 seconds
  • NewSlug generator toggle on the main page — generate slugs right after editing, above the fold
  • NewTable support — pasted tables from Google Docs now render correctly
  • NewRemove <br> after headings cleanup option (on by default)
  • NewPartial text selection copy in the HTML code view
  • NewSticky Clean HTML button at the bottom of the page
  • ImprovedHeading conversion now strips prefixes from existing heading tags and supports Chinese full-width colon (:)
  • ImprovedShared footer across all pages
v2.1.22026-03-17
  • FixBug fixes and improvements
v2.1.12026-03-16
  • FixBug fixes and improvements
v2.1.02026-03-16
  • NewFormatted/Raw toggle for the HTML code view
  • ImprovedCopying from the code panel now always gives clean, unformatted HTML
v2.0.02026-03-16
  • NewWelcome to Publish Helper — free online tools for content editors
  • ImprovedImproved search engine visibility
v1.1.02026-03-16
  • ImprovedClipboard copy — clean HTML output matches the code view
v1.0.02026-03-16
  • NewRich text editor with Google Docs paste support
  • NewHTML cleanup: strip styles, classes, empty tags, and Google Docs artifacts
  • NewHeading conversion from text prefixes to proper HTML tags
  • NewFind & replace with regex support and saveable presets
  • NewSyntax-highlighted HTML preview with one-click copy