diff --git a/media_entity_instagram.libraries.yml b/media_entity_instagram.libraries.yml
new file mode 100644
index 0000000..5b6e7c4
--- /dev/null
+++ b/media_entity_instagram.libraries.yml
@@ -0,0 +1,10 @@
+embed:
+  remote: //platform.twitter.com/widgets.js
+  license:
+    name: UNKNOWN
+    url: UNKNOWN
+    gpl-compatible: FALSE
+  js:
+    '//platform.instagram.com/en_US/embeds.js':
+      type: external
+      minified: true
diff --git a/src/Plugin/Field/FieldFormatter/InstagramEmbedFormatter.php b/src/Plugin/Field/FieldFormatter/InstagramEmbedFormatter.php
index ea86b38..35fa86f 100644
--- a/src/Plugin/Field/FieldFormatter/InstagramEmbedFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/InstagramEmbedFormatter.php
@@ -47,10 +47,21 @@ class InstagramEmbedFormatter extends FormatterBase {
             'position' => 'absolute',
             'scrolling' => 'no',
             'src' => '//instagram.com/p/' . $matches['shortcode'] . '/embed/',
-            'width' => $settings['width'],
-            'height' => $settings['height'],
           ],
         ];
+
+        if (!isset($settings['width']) || !isset($settings['height'])) {
+          $element[$delta]['#attributes']['style'] = 'width:100%;';
+          $element[$delta]['#attached']['library'][] = 'media_entity_instagram/embed';
+        }
+
+        if (isset($settings['width'])) {
+          $element[$delta]['#attributes']['width'] = $settings['width'];
+        }
+
+        if (isset($settings['height'])) {
+          $element[$delta]['#attributes']['height'] = $settings['height'];
+        }
       }
     }
 
@@ -62,8 +73,8 @@ class InstagramEmbedFormatter extends FormatterBase {
    */
   public static function defaultSettings() {
     return array(
-      'width' => '480',
-      'height' => '640',
+      'width' => NULL,
+      'height' => NULL,
     ) + parent::defaultSettings();
   }
 
@@ -78,7 +89,7 @@ class InstagramEmbedFormatter extends FormatterBase {
       '#title' => $this->t('Width'),
       '#default_value' => $this->getSetting('width'),
       '#min' => 1,
-      '#description' => $this->t('Width of instagram.'),
+      '#description' => $this->t('Width of instagram. Leave empty for responsive embed.'),
     );
 
     $elements['height'] = array(
@@ -86,7 +97,7 @@ class InstagramEmbedFormatter extends FormatterBase {
       '#title' => $this->t('Height'),
       '#default_value' => $this->getSetting('height'),
       '#min' => 1,
-      '#description' => $this->t('Height of instagram.'),
+      '#description' => $this->t('Height of instagram. Leave empty for responsive embed.'),
     );
 
     return $elements;
@@ -96,14 +107,16 @@ class InstagramEmbedFormatter extends FormatterBase {
    * {@inheritdoc}
    */
   public function settingsSummary() {
-    return [
-      $this->t('Width: @width px', [
-        '@width' => $this->getSetting('width'),
-      ]),
-      $this->t('Height: @height px', [
-        '@height' => $this->getSetting('height'),
-      ]),
-    ];
+    $settings = $this->getSettings();
+    if (!isset($settings['width']) || !isset($settings['height'])) {
+      return [$this->t('Responsive size.')];
+    }
+    else {
+      return [
+        $this->t('Width: @width px', ['@width' => $settings['width']]),
+        $this->t('Height: @height px', ['@height' => $settings['height']]),
+      ];
+    }
   }
 
 }
diff --git a/src/Tests/InstagramEmbedFormatterTest.php b/src/Tests/InstagramEmbedFormatterTest.php
index 032aeea..72b4430 100644
--- a/src/Tests/InstagramEmbedFormatterTest.php
+++ b/src/Tests/InstagramEmbedFormatterTest.php
@@ -138,6 +138,18 @@ class InstagramEmbedFormatterTest extends WebTestBase {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertText('Your settings have been saved.');
 
+    // First set absolute size of the embed.
+    $this->drupalPostAjaxForm(NULL, [], 'field_embed_code_settings_edit');
+    $edit = [
+      'fields[field_embed_code][settings_edit_form][settings][width]' => '400',
+      'fields[field_embed_code][settings_edit_form][settings][height]' => '400',
+    ];
+    $this->drupalPostAjaxForm(NULL, $edit, 'field_embed_code_plugin_settings_update');
+    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->assertText('Your settings have been saved.');
+    $this->assertText('Width: 400 px');
+    $this->assertText('Height: 400 px');
+
     // Create and save the media with an instagram media code.
     $this->drupalGet('media/add/' . $bundle->id());
 
@@ -154,8 +166,27 @@ class InstagramEmbedFormatterTest extends WebTestBase {
     $this->assertText('Title');
     $this->assertText('Embed code');
 
-    // Assert that the formatter exists on this page.
-    $this->assertFieldByXPath('//iframe');
+    // Assert that the formatter exists on this page and that it has absolute
+    // size.
+    $this->assertFieldByXPath('//iframe[@width="400" and @height="400"]');
+    $this->assertNoRaw('platform.instagram.com/en_US/embeds.js');
+
+    // Now try to set formatter to embed in the responsive mode.
+    $this->drupalGet('admin/structure/media/manage/' . $bundle->id() . '/display');
+    $this->drupalPostAjaxForm(NULL, [], "field_embed_code_settings_edit");
+    $edit = [
+      'fields[field_embed_code][settings_edit_form][settings][width]' => '',
+      'fields[field_embed_code][settings_edit_form][settings][height]' => '',
+    ];
+    $this->drupalPostAjaxForm(NULL, $edit, "field_embed_code_plugin_settings_update");
+    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->assertText('Your settings have been saved.');
+    $this->assertText('Responsive size');
+
+    // Check if the embed appears in responsive mode.
+    $this->drupalGet('media/1');
+    $this->assertFieldByXPath('//iframe[@style="width:100%;"]');
+    $this->assertRaw('platform.instagram.com/en_US/embeds.js');
   }
 
 }
