diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
index fb4c05d..fc764de 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Grid.php
@@ -104,4 +104,20 @@ public function buildOptionsForm(&$form, &$form_state) {
     }
   }
 
+  /**
+   * Return the token-replaced row or column classes for the specified result.
+   */
+  public function getCustomClass($result_index, $type) {
+    $class = $this->options[$type . '_class_custom'];
+    if ($this->usesFields() && $this->view->field) {
+      $class = strip_tags($this->tokenizeValue($class, $result_index));
+    }
+
+    $classes = explode(' ', $class);
+    foreach ($classes as &$class) {
+      $class = drupal_clean_css_identifier($class);
+    }
+    return implode(' ', $classes);
+  }
+
 }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php
index da2b95c..cd913da 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleGridTest.php
@@ -102,6 +102,11 @@ protected function assertGrid(ViewExecutable $view, $alignment, $columns) {
     // Ensure no extra columns were generated.
     $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, :columns)]', array(':columns' => 'col-' . ($columns + 1)));
     $this->assertFalse(count($result), ucfirst($alignment) . " $columns column grid: no extraneous columns exist.");
+    // Ensure tokens are being replaced in custom row/column classes.
+    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, "name-John")]');
+    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: Token replacement verified in custom column classes.");
+    $result = $this->xpath('//div[contains(@class, "views-row") and contains(@class, "age-25")]');
+    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: Token replacement verified in custom row classes.");
   }
 
 }
diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml
index c2a8915..a8d9579 100644
--- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_grid.yml
@@ -50,9 +50,9 @@ display:
           automatic_width: '1'
           alignment: horizontal
           col_class_default: '1'
-          col_class_custom: ''
+          col_class_custom: 'name-[name]'
           row_class_default: '1'
-          row_class_custom: ''
+          row_class_custom: 'age-[age]'
       row:
         type: fields
     display_plugin: default
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index f88413d..be041e4 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -763,7 +763,7 @@ function template_preprocess_views_view_grid(&$variables) {
   $num_rows = floor(count($variables['rows']) / $options['columns']);
 
   // Iterate over each rendered views result row.
-  foreach ($variables['rows'] as $item) {
+  foreach ($variables['rows'] as $result_index => $item) {
 
     // Add the item.
     if ($horizontal) {
@@ -785,7 +785,7 @@ function template_preprocess_views_view_grid(&$variables) {
         }
       }
       // Add custom row classes.
-      $row_class = array_filter(explode(' ', $options['row_class_custom']));
+      $row_class = array_filter(explode(' ', $variables['view']->style_plugin->getCustomClass($result_index, 'row')));
       if (!empty($row_class)) {
         $row_attributes['class'] = array_merge($row_attributes['class'], $row_class);
       }
@@ -810,7 +810,7 @@ function template_preprocess_views_view_grid(&$variables) {
         }
       }
       // Add custom column classes.
-      $col_class = array_filter(explode(' ', $options['col_class_custom']));
+      $col_class = array_filter(explode(' ', $variables['view']->style_plugin->getCustomClass($result_index, 'col')));
       if (!empty($col_class)) {
         $col_attributes['class'] = array_merge($col_attributes['class'], $col_class);
       }
