diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
index 4c3a27d..72397e6 100644
--- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -10,6 +10,8 @@
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\image\Entity\ImageStyle;
+use Drupal\file\FileInterface;
+use Drupal\image\ImageStyleInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Cache\Cache;
@@ -185,15 +187,12 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
       $link_file = TRUE;
     }
 
-    $image_style_setting = $this->getSetting('image_style');
-
-    // Collect cache tags to be added for each item in the field.
-    $base_cache_tags = [];
-    if (!empty($image_style_setting)) {
-      $image_style = $this->imageStyleStorage->load($image_style_setting);
-      $base_cache_tags = $image_style->getCacheTags();
+    $image_style_id = $this->getSetting('image_style');
+    if ($image_style_id) {
+      $image_style = $this->imageStyleStorage->load($image_style_id);
     }
 
+    /** @var FileInterface $file */
     foreach ($files as $delta => $file) {
       $cache_contexts = [];
       if (isset($link_file)) {
@@ -206,7 +205,6 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
         $url = Url::fromUri(file_create_url($image_uri));
         $cache_contexts[] = 'url.site';
       }
-      $cache_tags = Cache::mergeTags($base_cache_tags, $file->getCacheTags());
 
       // Extract field item attributes for the theme function, and unset them
       // from the $item so that the field template does not re-render them.
@@ -218,13 +216,19 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
         '#theme' => 'image_formatter',
         '#item' => $item,
         '#item_attributes' => $item_attributes,
-        '#image_style' => $image_style_setting,
         '#url' => $url,
         '#cache' => array(
-          'tags' => $cache_tags,
+          // Always use the file's cache tags.
+          'tags' => $file->getCacheTags(),
           'contexts' => $cache_contexts,
         ),
       );
+      // If the image style supports the file, use the image style and apply its
+      // cache tags to the rendered item.
+      if (isset($image_style) && $this->imageStyleSupportsFile($image_style, $file)) {
+        $elements[$delta]['#image_style'] = $image_style->id();
+        $elements[$delta]['#cache']['tags'] = Cache::mergeTags($elements[$delta]['#cache']['tags'], $image_style->getCacheTags());
+      }
     }
 
     return $elements;
@@ -267,4 +271,20 @@ public function onDependencyRemoval(array $dependencies) {
     return $changed;
   }
 
+  /**
+   * Determines if the given image style supports a file.
+   *
+   * @param \Drupal\image\ImageStyleInterface $image_style
+   *   The image style.
+   * @param \Drupal\file\FileInterface $file
+   *   The file entity.
+   *
+   * @return bool
+   *   Whether the image style supports the file.
+   */
+  protected function imageStyleSupportsFile(ImageStyleInterface $image_style, FileInterface $file) {
+    // Image styles don't work on SVGs.
+    return $file->getMimeType() !== 'image/svg+xml';
+  }
+
 }
