diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
index bcd0cf3380..82a1b55072 100644
--- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php
+++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
@@ -7,6 +7,7 @@
 use Drupal\entity_test\Entity\EntityTest;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\filter\Render\FilteredMarkup;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\filter\Entity\FilterFormat;
 use Drupal\Tests\user\Traits\UserCreationTrait;
@@ -29,6 +30,9 @@ class TextSummaryTest extends KernelTestBase {
     'entity_test',
   ];
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
@@ -304,4 +308,48 @@ public function testRequiredSummary() {
     $this->assertEquals('The summary field is required for A text field', $violations[0]->getMessage());
   }
 
+  /**
+   * Test text normalization when filter_html or filter_htmlcorrector enabled.
+   */
+  public function testNormalization() {
+    FilterFormat::create([
+      'format' => 'filter_html_enabled',
+      'filters' => [
+        'filter_html' => [
+          'status' => 1,
+          'settings' => [
+            'allowed_html' => '<strong>',
+          ],
+        ],
+      ],
+    ])->save();
+    FilterFormat::create([
+      'format' => 'filter_htmlcorrector_enabled',
+      'filters' => [
+        'filter_htmlcorrector' => [
+          'status' => 1,
+        ],
+      ],
+    ])->save();
+    FilterFormat::create([
+      'format' => 'neither_filter_enabled',
+      'filters' => [],
+    ])->save();
+
+    $text = '<div><strong><span>Hello World</span></strong></div>';
+    $filtered_markup = FilteredMarkup::create($text);
+    // With either HTML filter enabled, text_summary() will normalize the text
+    // using HTML::normalize().
+    $summary = text_summary($filtered_markup, 'filter_html_enabled', 30);
+    $this->assertContains('<div><strong><span>', $summary);
+    $this->assertContains('</span></strong></div>', $summary);
+    $summary = text_summary($filtered_markup, 'filter_htmlcorrector_enabled', 30);
+    $this->assertContains('<div><strong><span>', $summary);
+    $this->assertContains('</span></strong></div>', $summary);
+    // If neither filter is enabled, the text will not be normalized.
+    $summary = text_summary($filtered_markup, 'neither_filter_enabled', 30);
+    $this->assertContains('<div><strong><span>', $summary);
+    $this->assertNotContains('</span></strong></div>', $summary);
+  }
+
 }
diff --git a/core/modules/text/text.module b/core/modules/text/text.module
index ef367b095c..8e912c21b0 100644
--- a/core/modules/text/text.module
+++ b/core/modules/text/text.module
@@ -67,7 +67,7 @@ function text_summary($text, $format = NULL, $size = NULL) {
     $size = \Drupal::config('text.settings')->get('default_summary_length');
   }
 
-  // Find where the delimiter is in the body
+  // Find where the delimiter is in the body.
   $delimiter = strpos($text, '<!--break-->');
 
   // If the size is zero, and there is no delimiter, the entire body is the summary.
@@ -152,9 +152,14 @@ function text_summary($text, $format = NULL, $size = NULL) {
     }
   }
 
-  // If the htmlcorrector filter is present, apply it to the generated summary.
-  if (isset($format) && $filters->has('filter_htmlcorrector') && $filters->get('filter_htmlcorrector')->status) {
-    $summary = Html::normalize($summary);
+  // If filter_html or filter_htmlcorrector is enabled, normalize the output.
+  if (isset($format)) {
+    $filter_enabled = function ($filter) use ($filters) {
+      return $filters->has($filter) && $filters->get($filter)->status;
+    };
+    if ($filter_enabled('filter_html') || $filter_enabled('filter_htmlcorrector')) {
+      $summary = Html::normalize($summary);
+    }
   }
 
   return $summary;
