diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 4b0e4d57fd446550923a03487cc9b28f9d373c26..fd6e0487527094b027b46da8168cb0881a99cbde 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -1527,17 +1527,20 @@ protected function renderAsLink($alter, $text, $tokens) {
     $path = $url['path'];
 
     if (isset($url['query'])) {
-      // Remove query parameters that were assigned a query string replacement
-      // token for which there is no value available.
+      $raw_url = UrlHelper::parse($alter['path']);
       foreach ($url['query'] as $param => $val) {
-        if ($val == '%' . $param) {
-          unset($url['query'][$param]);
-        }
-        // Replace any empty query params from URL parsing with NULL. So the
-        // query will get built correctly with only the param key.
-        // @see \Drupal\Component\Utility\UrlHelper::buildQuery().
         if ($val === '') {
-          $url['query'][$param] = NULL;
+          // Remove query parameters that were assigned a query string
+          // replacement token for which there is no value available.
+          if (isset($raw_url['query'][$param]) && $raw_url['query'][$param] === '{{ arguments.' . $param . ' }}') {
+            unset($url['query'][$param]);
+          }
+          // Replace any actual empty query param from URL parsing with NULL. So
+          // the query will get built correctly with only the param key.
+          // @see \Drupal\Component\Utility\UrlHelper::buildQuery().
+          else {
+            $url['query'][$param] = NULL;
+          }
         }
       }
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index c8795b47e6fd6b77bb5a60b638a6b08f08da6ef4..406f3b62517cb289f0b37280dd15f114bad8420d 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -377,6 +377,13 @@ public static function providerTestRenderAsLinkWithPathAndOptions() {
     $data[] = ['www.example.com', ['external' => TRUE], '<a href="http://www.example.com">value</a>'];
     $data[] = ['', ['external' => TRUE], 'value'];
 
+    // Test with empty query parameters.
+    $data[] = ['test-path', ['query' => ['foo' => '']], '<a href="/test-path?foo">value</a>'];
+    // Test with query parameters that have tokens.
+    $data[] = ['test-path', ['query' => ['foo' => '{{ arguments.foo }}']], '<a href="/test-path">value</a>'];
+    // Test with mixed query parameters.
+    $data[] = ['test-path', ['query' => ['foo' => '', 'bar' => '{{ arguments.bar }}']], '<a href="/test-path?foo">value</a>'];
+
     return $data;
   }