diff --git a/src/Plugin/Field/FieldFormatter/IframeDefaultFormatter.php b/src/Plugin/Field/FieldFormatter/IframeDefaultFormatter.php
index 2413e4e6ee0c2cdc4e6f093485c20e85dadbdb3f..ae9014f9f9fa8659cf02b5e93506b1346c21be25 100644
--- a/src/Plugin/Field/FieldFormatter/IframeDefaultFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/IframeDefaultFormatter.php
@@ -191,7 +191,7 @@ class IframeDefaultFormatter extends FormatterBase {
     $options['id'] = $options['name'] = $htmlid;
 
     // Append active class.
-    $options['class'] = $item->class ?? '';
+    $options['class'] = $item->class ?? NULL;
 
     // Responsive start. Test class for iframe-responsive.
     $style = '#' . $htmlid . ' {' . $style . '}';
diff --git a/templates/iframe.html.twig b/templates/iframe.html.twig
index 9d319d072dde6fa3a7c128d7df604d08357ca1e1..615044dfbd472740ef69446be7ca576a0de460cc 100644
--- a/templates/iframe.html.twig
+++ b/templates/iframe.html.twig
@@ -11,12 +11,13 @@
 * - headerlevel: header level
 */
 #}
-<div{% if attributes.class is not empty %} class="{{ attributes.class }}"{% endif %}>
+{% set iframe_container_classes = attributes.class|render %}
+<div{% if iframe_container_classes %} class="{{ attributes.class }}"{% endif %}>
   {% if text is not empty %}
     <h{{ headerlevel ?? 3 }} class="iframe_title">{{ text }}</h{{ headerlevel ?? 3 }}>
   {% endif %}
   <style type="text/css">{{ style|raw }}</style>
-  <iframe {{ attributes }}>
+  <iframe {{ attributes|without('class') }}>
     {{ 'Your browser does not support iframes, but you can visit <a href=":url">@text</a>'|t({ ':url': src, '@text': text }) }}
   </iframe>
 </div>