diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
index 4c3a27d..e3ade5e 100644
--- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -5,11 +5,13 @@
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Image\ImageFactory;
 use Drupal\Core\Link;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
 use Drupal\image\Entity\ImageStyle;
+use Drupal\file\FileInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Cache\Cache;
@@ -42,6 +44,13 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
   protected $imageStyleStorage;
 
   /**
+   * The image factory service.
+   *
+   * @var \Drupal\Core\Image\ImageFactory
+   */
+  protected $imageFactory;
+
+  /**
    * Constructs an ImageFormatter object.
    *
    * @param string $plugin_id
@@ -61,10 +70,11 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
    * @param \Drupal\Core\Session\AccountInterface $current_user
    *   The current user.
    */
-  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, EntityStorageInterface $image_style_storage) {
+  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, EntityStorageInterface $image_style_storage, ImageFactory $image_factory) {
     parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
     $this->currentUser = $current_user;
     $this->imageStyleStorage = $image_style_storage;
+    $this->imageFactory = $image_factory;
   }
 
   /**
@@ -80,7 +90,8 @@ public static function create(ContainerInterface $container, array $configuratio
       $configuration['view_mode'],
       $configuration['third_party_settings'],
       $container->get('current_user'),
-      $container->get('entity.manager')->getStorage('image_style')
+      $container->get('entity.manager')->getStorage('image_style'),
+      $container->get('image.factory')
     );
   }
 
@@ -185,15 +196,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 +214,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 +225,20 @@ 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 we're using an image style, and the current image toolkit supports
+      // this file type, apply the image style's cache tags to the rendered
+      // item.
+      if (isset($image_style) && $this->imageFactory->get($file->getFileUri())->isValid()) {
+        $elements[$delta]['#image_style'] = $image_style->id();
+        $elements[$delta]['#cache']['tags'] = Cache::mergeTags($elements[$delta]['#cache']['tags'], $image_style->getCacheTags());
+      }
     }
 
     return $elements;
