diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
index a40b56adb36..8a784bbbf3a 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
 
+use Drupal\Core\Cache\Cache;
 use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
@@ -159,6 +160,13 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
     $view_mode = $this->getSetting('view_mode');
     $elements = [];
 
+    $elements['#cache']['tags'] = [];
+    foreach ($items as $delta => $item) {
+      if (!empty($item->_loaded)) {
+        $elements['#cache']['tags'] = Cache::mergeTags($elements['#cache']['tags'], $item->entity->getCacheTags());
+      }
+    }
+
     foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) {
       // Due to render caching and delayed calls, the viewElements() method
       // will be called later in the rendering process through a '#pre_render'
