diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 1c4a445..6bb85eb 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -263,6 +263,10 @@ function size_format( $bytes, $decimals = 0 ) {
 		'B'  => 1,
 	);
 
+	if ( 0 === $bytes ) {
+		return number_format_i18n( 0, $decimals ) . ' B';
+	}
+
 	foreach ( $quant as $unit => $mag ) {
 		if ( doubleval( $bytes ) >= $mag ) {
 			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
diff --git tests/phpunit/tests/functions/sizeFormat.php tests/phpunit/tests/functions/sizeFormat.php
new file mode 100644
index 0000000..0222069
--- /dev/null
+++ tests/phpunit/tests/functions/sizeFormat.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Tests for size_format()
+ *
+ * @group functions.php
+ * @ticket 36635
+ */
+class Tests_Functions_Size_Format extends WP_UnitTestCase {
+	public function _data_size_format() {
+		return array(
+			array( '', 0, false ),
+			array( '-1', 0, false ),
+			array( -1, 0, false ),
+			array( 0, 0, '0 B' ),
+			array( 1, 0, '1 B' ),
+			array( 1023, 0, '1,023 B' ),
+			array( KB_IN_BYTES, 0, '1 kB' ),
+			array( KB_IN_BYTES, 2, '1.00 kB' ),
+			array( 2.5 * KB_IN_BYTES, 0, '3 kB' ),
+			array( 2.5 * KB_IN_BYTES, 2, '2.50 kB' ),
+			array( 10 * KB_IN_BYTES, 0, '10 kB' ),
+			array( (string) 1024 * KB_IN_BYTES, 2, '1.00 MB' ),
+			array( MB_IN_BYTES, 0, '1 MB' ),
+			array( 2.5 * MB_IN_BYTES, 0, '3 MB' ),
+			array( 2.5 * MB_IN_BYTES, 2, '2.50 MB' ),
+			array( (string) 1024 * MB_IN_BYTES, 2, '1.00 GB' ),
+			array( GB_IN_BYTES, 0, '1 GB' ),
+			array( 2.5 * GB_IN_BYTES, 0, '3 GB' ),
+			array( 2.5 * GB_IN_BYTES, 2, '2.50 GB' ),
+			array( (string) 1024 * GB_IN_BYTES, 2, '1.00 TB' ),
+			array( TB_IN_BYTES, 0, '1 TB' ),
+			array( 2.5 * TB_IN_BYTES, 0, '3 TB' ),
+			array( 2.5 * TB_IN_BYTES, 2, '2.50 TB' ),
+		);
+	}
+
+	/**
+	 * @dataProvider _data_size_format
+	 *
+	 * @param $bytes
+	 * @param $decimals
+	 * @param $expected
+	 */
+	public function test_size_format( $bytes, $decimals, $expected ) {
+		$this->assertSame( $expected, size_format( $bytes, $decimals ) );
+	}
+}
