diff --git a/tensorflow/contrib/makefile/proto_text_cc_files.txt b/tensorflow/contrib/makefile/proto_text_cc_files.txt
index d7ad266f678..f5b157db42b 100644
--- a/tensorflow/contrib/makefile/proto_text_cc_files.txt
+++ b/tensorflow/contrib/makefile/proto_text_cc_files.txt
@@ -36,7 +36,6 @@ tensorflow/core/lib/strings/proto_text_util.cc
 tensorflow/core/lib/strings/scanner.cc
 tensorflow/core/lib/strings/str_util.cc
 tensorflow/core/lib/strings/strcat.cc
-tensorflow/core/lib/strings/stringprintf.cc
 tensorflow/core/lib/wav/wav_io.cc
 tensorflow/core/platform/cpu_info.cc
 tensorflow/core/platform/default/logging.cc
@@ -56,6 +55,7 @@ tensorflow/core/platform/posix/posix_file_system.cc
 tensorflow/core/platform/protobuf.cc
 tensorflow/core/platform/protobuf_util.cc
 tensorflow/core/platform/setround.cc
+tensorflow/core/platform/stringprintf.cc
 tensorflow/core/platform/tensor_coding.cc
 tensorflow/core/platform/tracing.cc
 tensorflow/tools/proto_text/gen_proto_text_functions.cc
diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD
index bac454b5b84..8ce55556b68 100644
--- a/tensorflow/core/BUILD
+++ b/tensorflow/core/BUILD
@@ -768,6 +768,7 @@ cc_library(
     deps = [
         ":lib_internal",
         "//tensorflow/core/platform:stringpiece",
+        "//tensorflow/core/platform:stringprintf",
         "@com_google_absl//absl/container:inlined_vector",
         "@com_google_absl//absl/strings",
         "@com_google_absl//absl/types:optional",
@@ -2497,6 +2498,7 @@ cc_library(
                "//tensorflow/core/lib/bfloat16",
                "//tensorflow/core/platform:abi",
                "//tensorflow/core/platform:cpu_info",
+               "//tensorflow/core/platform:stringprintf",
                "//tensorflow/core/platform/default/build_config:platformlib",
                "@snappy",
                "@zlib_archive//:zlib",
@@ -3802,7 +3804,6 @@ tf_cc_tests(
         "lib/strings/scanner_test.cc",
         "lib/strings/str_util_test.cc",
         "lib/strings/strcat_test.cc",
-        "lib/strings/stringprintf_test.cc",
         "lib/wav/wav_io_test.cc",
         "//tensorflow/core/platform:fingerprint_test.cc",
         "//tensorflow/core/platform:integral_types_test.cc",
@@ -3813,6 +3814,7 @@ tf_cc_tests(
         "//tensorflow/core/platform:profile_utils/cpu_utils_test.cc",
         "//tensorflow/core/platform:stacktrace_handler_test.cc",
         "//tensorflow/core/platform:stringpiece_test.cc",
+        "//tensorflow/core/platform:stringprintf_test.cc",
         "//tensorflow/core/platform:subprocess_test.cc",
         "//tensorflow/core/platform:vmodule_benchmark_test.cc",
     ],
@@ -3825,6 +3827,7 @@ tf_cc_tests(
         ":test",
         ":test_main",
         "//tensorflow/core/platform:stringpiece",
+        "//tensorflow/core/platform:stringprintf",
         "//third_party/eigen3",
         "@com_google_absl//absl/strings",
         "@com_google_absl//absl/synchronization",
diff --git a/tensorflow/core/lib/strings/stringprintf.h b/tensorflow/core/lib/strings/stringprintf.h
index 52af410d429..836632d7866 100644
--- a/tensorflow/core/lib/strings/stringprintf.h
+++ b/tensorflow/core/lib/strings/stringprintf.h
@@ -23,30 +23,6 @@ limitations under the License.
 #ifndef TENSORFLOW_CORE_LIB_STRINGS_STRINGPRINTF_H_
 #define TENSORFLOW_CORE_LIB_STRINGS_STRINGPRINTF_H_
 
-#include <stdarg.h>
-#include <string>
-
-#include "tensorflow/core/platform/macros.h"
-#include "tensorflow/core/platform/types.h"
-
-namespace tensorflow {
-namespace strings {
-
-// Return a C++ string
-extern string Printf(const char* format, ...)
-    // Tell the compiler to do printf format string checking.
-    TF_PRINTF_ATTRIBUTE(1, 2);
-
-// Append result to a supplied string
-extern void Appendf(string* dst, const char* format, ...)
-    // Tell the compiler to do printf format string checking.
-    TF_PRINTF_ATTRIBUTE(2, 3);
-
-// Lower-level routine that takes a va_list and appends to a specified
-// string.  All other routines are just convenience wrappers around it.
-extern void Appendv(string* dst, const char* format, va_list ap);
-
-}  // namespace strings
-}  // namespace tensorflow
+#include "tensorflow/core/platform/stringprintf.h"
 
 #endif  // TENSORFLOW_CORE_LIB_STRINGS_STRINGPRINTF_H_
diff --git a/tensorflow/core/platform/BUILD b/tensorflow/core/platform/BUILD
index 98ab3d1241b..0574cecf50b 100644
--- a/tensorflow/core/platform/BUILD
+++ b/tensorflow/core/platform/BUILD
@@ -168,6 +168,16 @@ cc_library(
     ],
 )
 
+cc_library(
+    name = "stringprintf",
+    srcs = ["stringprintf.cc"],
+    hdrs = ["stringprintf.h"],
+    deps = [
+        ":macros",
+        ":types",
+    ],
+)
+
 cc_library(
     name = "tstring",
     hdrs = ["tstring.h"],
@@ -218,6 +228,7 @@ filegroup(
             "cpu_info.cc",
             "platform_strings.cc",
             "protobuf.cc",
+            "stringprintf.cc",
         ],
     ),
     visibility = ["//tensorflow/core:__pkg__"],
@@ -277,6 +288,7 @@ filegroup(
             "gif.h",
             "jpeg.h",
             "png.h",
+            "stringprintf.h",
             "**/cuda.h",
             "**/rocm.h",
             "**/stream_executor.h",
@@ -306,6 +318,7 @@ filegroup(
             "cpu_info.cc",
             "platform_strings.cc",
             "protobuf.cc",
+            "stringprintf.cc",
         ],
     ),
     visibility = ["//tensorflow/core:__pkg__"],
diff --git a/tensorflow/core/lib/strings/stringprintf.cc b/tensorflow/core/platform/stringprintf.cc
similarity index 97%
rename from tensorflow/core/lib/strings/stringprintf.cc
rename to tensorflow/core/platform/stringprintf.cc
index bbffa062a93..89d99c8d53c 100644
--- a/tensorflow/core/lib/strings/stringprintf.cc
+++ b/tensorflow/core/platform/stringprintf.cc
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 ==============================================================================*/
 
-#include "tensorflow/core/lib/strings/stringprintf.h"
+#include "tensorflow/core/platform/stringprintf.h"
 
 #include <errno.h>
 #include <stdarg.h>  // For va_list and related operations
diff --git a/tensorflow/core/platform/stringprintf.h b/tensorflow/core/platform/stringprintf.h
new file mode 100644
index 00000000000..802b568101e
--- /dev/null
+++ b/tensorflow/core/platform/stringprintf.h
@@ -0,0 +1,52 @@
+/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// Printf variants that place their output in a C++ string.
+//
+// Usage:
+//      string result = strings::Printf("%d %s\n", 10, "hello");
+//      strings::Appendf(&result, "%d %s\n", 20, "there");
+
+#ifndef TENSORFLOW_CORE_PLATFORM_STRINGPRINTF_H_
+#define TENSORFLOW_CORE_PLATFORM_STRINGPRINTF_H_
+
+#include <stdarg.h>
+
+#include <string>
+
+#include "tensorflow/core/platform/macros.h"
+#include "tensorflow/core/platform/types.h"
+
+namespace tensorflow {
+namespace strings {
+
+// Return a C++ string
+extern string Printf(const char* format, ...)
+    // Tell the compiler to do printf format string checking.
+    TF_PRINTF_ATTRIBUTE(1, 2);
+
+// Append result to a supplied string
+extern void Appendf(string* dst, const char* format, ...)
+    // Tell the compiler to do printf format string checking.
+    TF_PRINTF_ATTRIBUTE(2, 3);
+
+// Lower-level routine that takes a va_list and appends to a specified
+// string.  All other routines are just convenience wrappers around it.
+extern void Appendv(string* dst, const char* format, va_list ap);
+
+}  // namespace strings
+}  // namespace tensorflow
+
+#endif  // TENSORFLOW_CORE_PLATFORM_STRINGPRINTF_H_
diff --git a/tensorflow/core/lib/strings/stringprintf_test.cc b/tensorflow/core/platform/stringprintf_test.cc
similarity index 98%
rename from tensorflow/core/lib/strings/stringprintf_test.cc
rename to tensorflow/core/platform/stringprintf_test.cc
index 02cf4cbcadc..d24523be843 100644
--- a/tensorflow/core/lib/strings/stringprintf_test.cc
+++ b/tensorflow/core/platform/stringprintf_test.cc
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 ==============================================================================*/
 
-#include "tensorflow/core/lib/strings/stringprintf.h"
+#include "tensorflow/core/platform/stringprintf.h"
 
 #include <string>