diff --git a/components/cronet/android/dependencies.txt b/components/cronet/android/dependencies.txt
index 02da876219f2b..8bb5403893f27 100644
--- a/components/cronet/android/dependencies.txt
+++ b/components/cronet/android/dependencies.txt
@@ -36,6 +36,7 @@
 //net/dns/public
 //net/http
 //net/third_party/quiche
+//net/third_party/uri_template
 //net/traffic_annotation
 //third_party/abseil-cpp
 //third_party/android_build_tools
diff --git a/net/BUILD.gn b/net/BUILD.gn
index 593a66da05669..1e8effb641656 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -1794,11 +1794,11 @@ source_set("net_public_deps") {
   public_deps = [
     ":buildflags",
     ":net_nqe_proto",
-    ":uri_template",
     "//base",
     "//crypto",
     "//net/third_party/quiche",
     "//net/third_party/quiche:net_quic_test_tools_proto",
+    "//net/third_party/uri_template",
     "//net/traffic_annotation",
     "//third_party/boringssl",
     "//url",
@@ -1809,19 +1809,6 @@ source_set("net_public_deps") {
   }
 }
 
-component("uri_template") {
-  sources = [
-    "third_party/uri_template/uri_template.cc",
-    "third_party/uri_template/uri_template.h",
-  ]
-  visibility = [
-    ":net_public_deps",
-    "//net/third_party/quiche",
-  ]
-  defines = [ "IS_URI_TEMPLATE_IMPL" ]
-  public_deps = [ "//base" ]
-}
-
 grit("net_resources") {
   source = "base/net_resources.grd"
   outputs = [
@@ -2869,7 +2856,6 @@ test("net_unittests") {
     "test/embedded_test_server/http_request_unittest.cc",
     "test/embedded_test_server/http_response_unittest.cc",
     "test/run_all_unittests.cc",
-    "third_party/uri_template/uri_template_test.cc",
     "tools/content_decoder_tool/content_decoder_tool.cc",
     "tools/content_decoder_tool/content_decoder_tool.h",
     "tools/content_decoder_tool/content_decoder_tool_unittest.cc",
@@ -2980,6 +2966,7 @@ test("net_unittests") {
     "//net/http:transport_security_state_unittest_data",
     "//net/http:transport_security_state_unittest_data_default",
     "//net/third_party/quiche:quiche_tests",
+    "//net/third_party/uri_template:uri_template_tests",
     "//net/tools/huffman_trie:huffman_trie_generator_sources",
     "//testing/gmock",
     "//testing/gtest",
@@ -4003,16 +3990,6 @@ fuzzer_test("net_quic_session_pool_fuzzer") {
   ]
 }
 
-fuzzer_test("net_uri_template_fuzzer") {
-  sources = [ "third_party/uri_template/uri_template_fuzzer.cc" ]
-  deps = [
-    ":net_fuzzer_test_support",
-    "//base",
-    "//net",
-  ]
-  dict = "data/fuzzer_dictionaries/net_uri_template_fuzzer.dict"
-}
-
 if (is_linux || is_chromeos) {
   fuzzer_test("net_base_address_tracker_linux_fuzzer") {
     sources = [ "base/address_tracker_linux_fuzzer.cc" ]
diff --git a/net/third_party/quiche/BUILD.gn b/net/third_party/quiche/BUILD.gn
index 93911f4559ea4..43d04ac38242f 100644
--- a/net/third_party/quiche/BUILD.gn
+++ b/net/third_party/quiche/BUILD.gn
@@ -80,7 +80,7 @@ component("quiche") {
   all_dependent_configs = [ ":quiche_config" ]
 
   deps = [
-    "//net:uri_template",
+    "//net/third_party/uri_template",
     "//third_party/protobuf:protobuf_lite",
     "//third_party/zlib",
   ]
diff --git a/net/third_party/uri_template/BUILD.gn b/net/third_party/uri_template/BUILD.gn
new file mode 100644
index 0000000000000..0d5166e85aef3
--- /dev/null
+++ b/net/third_party/uri_template/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright 2024 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import("//testing/libfuzzer/fuzzer_test.gni")
+
+component("uri_template") {
+  sources = [
+    "uri_template.cc",
+    "uri_template.h",
+  ]
+  visibility = [
+    ":uri_template_tests",
+    "//net:net_public_deps",
+    "//net/third_party/quiche",
+  ]
+  defines = [ "IS_URI_TEMPLATE_IMPL" ]
+  public_deps = [ "//base" ]
+}
+
+source_set("uri_template_tests") {
+  testonly = true
+  sources = [ "uri_template_test.cc" ]
+  deps = [
+    ":uri_template",
+    "//testing/gmock",
+    "//testing/gtest",
+  ]
+}
+
+fuzzer_test("net_uri_template_fuzzer") {
+  sources = [ "uri_template_fuzzer.cc" ]
+  deps = [
+    "//base",
+    "//net",
+    "//net:net_fuzzer_test_support",
+  ]
+  dict = "//net/data/fuzzer_dictionaries/net_uri_template_fuzzer.dict"
+}