Index: src/wp-includes/pluggable.php
===================================================================
--- src/wp-includes/pluggable.php	(revision 41181)
+++ src/wp-includes/pluggable.php	(working copy)
@@ -2420,7 +2420,7 @@
  *
  * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
  *                           user email, WP_User object, WP_Post object, or WP_Comment object.
- * @param int    $size       Optional. Height and width of the avatar image file in pixels. Default 96.
+ * @param int|string $size   Optional. Height and width of the avatar image file in pixels. Default 96.
  * @param string $default    Optional. URL for the default image or a default type. Accepts '404'
  *                           (return a 404 instead of a default image), 'retro' (8bit), 'monsterid'
  *                           (monster), 'wavatar' (cartoon face), 'indenticon' (the "quilt"),
@@ -2466,17 +2466,36 @@
 		$args = array();
 	}
 
-	$args['size']    = (int) $size;
+	// At this point, $size can be either a string or an integer.
+	$args['size']    = $size;
 	$args['default'] = $default;
 	$args['alt']     = $alt;
 
 	$args = wp_parse_args( $args, $defaults );
 
+	// Check for valid registered WordPress image size values.
+	if ( is_string( $size ) && in_array( $size, get_intermediate_image_sizes() ) ) {
+		// Set the height and width to the dimensions established by the registered WordPress image size.
+		$args['height'] = get_option( "{$size}_size_h" );
+		$args['width']  = get_option( "{$size}_size_w" );
+
+		// Height and width weren't assigned in the last step because the image size is custom.
+		if ( empty( $args['height'] ) || empty( $args['width'] ) ) {
+			$sizes = wp_get_additional_image_sizes();
+
+			if ( isset( $sizes[ $size ] ) ) {
+				$args['height'] = $sizes[ $size ]['height'];
+				$args['width']  = $sizes[ $size ]['width'];
+			}
+		}
+	}
+
 	if ( empty( $args['height'] ) ) {
-		$args['height'] = $args['size'];
+		$args['height'] = (int) is_numeric( $size ) ? $size : $defaults['size'];
 	}
+
 	if ( empty( $args['width'] ) ) {
-		$args['width'] = $args['size'];
+		$args['width']  = (int) is_numeric( $size ) ? $size : $defaults['size'];
 	}
 
 	if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
@@ -2503,6 +2522,10 @@
 		return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
 	}
 
+	// Not filtering pre_get_avatar, so revert to Gravatar square sizing. Reset the size to the height in case it is a string.
+	$args['width'] = $args['height'];
+	$args['size']  = $args['height'];
+
 	if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) {
 		return false;
 	}
Index: tests/phpunit/tests/avatar.php
===================================================================
--- tests/phpunit/tests/avatar.php	(revision 41181)
+++ tests/phpunit/tests/avatar.php	(working copy)
@@ -229,4 +229,26 @@
 		return $this->fakeURL;
 	}
 
+	/**
+	 * @ticket 37773
+	 */
+	public function test_get_avatar_same_size_by_int_or_string() {
+		$img1 = get_avatar( 1, 150 );
+		$img2 = get_avatar( 1, 'thumbnail' );
+		$this->assertEquals( $img1, $img2 );
+
+		$img3 = get_avatar( 1, 300 );
+		$img4 = get_avatar( 1, 'medium' );
+		$this->assertEquals( $img3, $img4 );
+
+		$img5 = get_avatar( 1, 1024 );
+		$img6 = get_avatar( 1, 'large' );
+		$this->assertEquals( $img5, $img6 );
+	}
+	public function test_get_avatar_default_size_returned_if_string_size_is_not_registered() {
+		$img1 = get_avatar( 1 );
+		$img2 = get_avatar( 1, 'not-a-registered-size' );
+
+		$this->assertEquals( $img1, $img2 );
+	}
 }
