diff --git includes/bootstrap.inc includes/bootstrap.inc
index de9a175..65d562c 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -177,12 +177,6 @@ define('DRUPAL_ANONYMOUS_RID', 1);
 define('DRUPAL_AUTHENTICATED_RID', 2);
 
 /**
- * The number of bytes in a kilobyte. For more information, visit
- * http://en.wikipedia.org/wiki/Kilobyte.
- */
-define('DRUPAL_KILOBYTE', 1024);
-
-/**
  * The language code used when no language is explicitly assigned.
  *
  * Defined by ISO639-2 for "Undetermined".
diff --git includes/common.inc includes/common.inc
index 00b2e71..93a5c86 100644
--- includes/common.inc
+++ includes/common.inc
@@ -1724,63 +1724,89 @@ function format_plural($count, $singular, $plural, array $args = array(), array
 }
 
 /**
- * Parse a given byte count.
+ * Parses a human-readable representation of a byte count.
+ *
+ * See http://en.wikipedia.org/wiki/Binary_prefix for more information.
  *
  * @param $size
- *   A size expressed as a number of bytes with optional SI or IEC binary unit
- *   prefix (e.g. 2, 3K, 5MB, 10G, 6GiB, 8 bytes, 9mbytes).
+ *   A byte count expressed as a numeric quantity, optionally followed by a
+ *   unit:
+ *    - SI (powers of 1000), e.g. kB, MB, megabytes, G, terabyte.
+ *    - IEC (powers of 1024), e.g. kibibyte, MiB, gibibytes.
+ * @param $force_iec
+ *   Override the unit type detection for old-style of powers of 1024.
+ *
  * @return
- *   An integer representation of the size in bytes.
+ *   An integer representation of the byte count.
+ *
+ * @see format_size()
  */
-function parse_size($size) {
-  $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
-  $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
-  if ($unit) {
-    // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
-    return round($size * pow(DRUPAL_KILOBYTE, stripos('bkmgtpezy', $unit[0])));
+function parse_size($size, $force_iec = FALSE) {
+
+  // Break up the size into quantity and unit.
+  preg_match('/([\d.]*)[\s]*(.*)/', $size, $matches);
+
+  $quantity = $matches[1];
+
+  if (!is_numeric($quantity)) {
+    return FALSE;
   }
-  else {
-    return round($size);
+
+  $unit = strtolower($matches[2]);
+  $unit_length = strlen($unit);
+
+  if ($unit_length > 0) {
+
+    // Determine if the unit is SI or IEC.
+    // The second letter of an abbreviated IEC unit is always 'i', e.g. Mi or MiB.
+    // The forth letter of an unabbreviated IEC unit is always 'i', e.g. mebibyte.
+    if ($force_iec || (($unit_length == 2 || $unit_length == 3) && $unit[1] == 'i') || ($unit_length >= 4 && $unit[3] == 'i')) {
+      $base = 1024;
+    }
+    else {
+      $base = 1000;
+    }
+
+    $quantity *= pow($base, strpos('bkmgtpezy', $unit[0]));
   }
+
+  // Make sure an integer is returned.
+  return floor($quantity);
 }
 
 /**
- * Generate a string representation for the given byte count.
+ * Generates a human-readable representation of a byte count.
+ *
+ * See http://en.wikipedia.org/wiki/Kilobyte for more information.
  *
  * @param $size
- *   A size in bytes.
+ *   A byte count.
  * @param $langcode
  *   Optional language code to translate to a language other than what is used
  *   to display the page.
+ *
  * @return
- *   A translated string representation of the size.
+ *   A human readable representation of the byte count.
+ *
+ * @see parse_size()
  */
 function format_size($size, $langcode = NULL) {
-  if ($size < DRUPAL_KILOBYTE) {
+
+  if ($size < 1000) {
     return format_plural($size, '1 byte', '@count bytes', array(), array('langcode' => $langcode));
   }
-  else {
-    $size = $size / DRUPAL_KILOBYTE; // Convert bytes to kilobytes.
-    $units = array(
-      t('@size KB', array(), array('langcode' => $langcode)),
-      t('@size MB', array(), array('langcode' => $langcode)),
-      t('@size GB', array(), array('langcode' => $langcode)),
-      t('@size TB', array(), array('langcode' => $langcode)),
-      t('@size PB', array(), array('langcode' => $langcode)),
-      t('@size EB', array(), array('langcode' => $langcode)),
-      t('@size ZB', array(), array('langcode' => $langcode)),
-      t('@size YB', array(), array('langcode' => $langcode)),
-    );
-    foreach ($units as $unit) {
-      if (round($size, 2) >= DRUPAL_KILOBYTE) {
-        $size = $size / DRUPAL_KILOBYTE;
-      }
-      else {
-        break;
-      }
+
+  $units = array('kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
+
+  foreach ($units as $unit) {
+    $size /= 1000;
+
+    if ($size < 1000) {
+      break;
     }
-    return str_replace('@size', round($size, 2), $unit);
   }
+
+  return round($size, 2) . ' ' . $unit;
 }
 
 /**
diff --git includes/file.inc includes/file.inc
index 26a6c41..bf3e9b3 100644
--- includes/file.inc
+++ includes/file.inc
@@ -2013,11 +2013,11 @@ function file_upload_max_size() {
 
   if ($max_size < 0) {
     // Start with post_max_size.
-    $max_size = parse_size(ini_get('post_max_size'));
+    $max_size = parse_size(ini_get('post_max_size'), TRUE);
 
     // If upload_max_size is less, then reduce. Except if upload_max_size is
     // zero, which indicates no limit.
-    $upload_max = parse_size(ini_get('upload_max_filesize'));
+    $upload_max = parse_size(ini_get('upload_max_filesize'), TRUE);
     if ($upload_max > 0 && $upload_max < $max_size) {
       $max_size = $upload_max;
     }
diff --git modules/color/color.module modules/color/color.module
index ff6c70e..4793269 100644
--- modules/color/color.module
+++ modules/color/color.module
@@ -302,7 +302,7 @@ function color_scheme_form_submit($form, &$form_state) {
     // size (both at 32bpp).
     $required = $width * $height * 8;
     $usage = memory_get_usage();
-    $limit = parse_size(ini_get('memory_limit'));
+    $limit = parse_size(ini_get('memory_limit'), TRUE);
     if ($usage + $required > $limit) {
       drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $limit), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
       return;
diff --git modules/file/file.field.inc modules/file/file.field.inc
index 5508b9b..c1b0934 100644
--- modules/file/file.field.inc
+++ modules/file/file.field.inc
@@ -101,7 +101,7 @@ function file_field_instance_settings_form($field, $instance) {
     '#type' => 'textfield',
     '#title' => t('Maximum upload size'),
     '#default_value' => $settings['max_filesize'],
-    '#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).', array('%limit' => format_size(file_upload_max_size()))),
+    '#description' => t('Enter a value like "512" (bytes), "80 kB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).', array('%limit' => format_size(file_upload_max_size()))),
     '#size' => 10,
     '#element_validate' => array('_file_generic_settings_max_filesize'),
     '#weight' => 5,
@@ -126,7 +126,7 @@ function file_field_instance_settings_form($field, $instance) {
  */
 function _file_generic_settings_max_filesize($element, &$form_state) {
   if (!empty($element['#value']) && !is_numeric(parse_size($element['#value']))) {
-    form_error($element, t('The "!name" option must contain a valid value. You may either leave the text field empty or enter a string like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes).', array('!name' => t($element['title']))));
+    form_error($element, t('The "!name" option must contain a valid value. You may either leave the text field empty or enter a string like "512" (bytes), "80 kB" (kilobytes) or "50 MB" (megabytes).', array('!name' => t($element['title']))));
   }
 }
 
@@ -542,7 +542,7 @@ function file_field_widget_form(&$form, &$form_state, $field, $instance, $langco
  */
 function file_field_widget_upload_validators($field, $instance) {
   // Cap the upload size according to the PHP limit.
-  $max_filesize = parse_size(file_upload_max_size());
+  $max_filesize = file_upload_max_size();
   if (!empty($instance['settings']['max_filesize']) && parse_size($instance['settings']['max_filesize']) < $max_filesize) {
     $max_filesize = parse_size($instance['settings']['max_filesize']);
   }
diff --git modules/file/tests/file.test modules/file/tests/file.test
index 99f95b4..0d4c0dd 100644
--- modules/file/tests/file.test
+++ modules/file/tests/file.test
@@ -802,14 +802,14 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
     $field = field_info_field($field_name);
     $instance = field_info_instance('node', $field_name, $type_name);
 
-    $small_file = $this->getTestFile('text', 131072); // 128KB.
-    $large_file = $this->getTestFile('text', 1310720); // 1.2MB
+    $small_file = $this->getTestFile('text', 128000); // 128KB.
+    $large_file = $this->getTestFile('text', 1200000); // 1.2MB
 
     // Test uploading both a large and small file with different increments.
     $sizes = array(
-      '1M' => 1048576,
-      '1024K' => 1048576,
-      '1048576' => 1048576,
+      '1M' => 1000000,
+      '1000K' => 1000000,
+      '1000000' => 1000000,
     );
 
     foreach ($sizes as $max_filesize => $file_limit) {
diff --git modules/image/image.test modules/image/image.test
index 00f79d8..eaa6ee0 100644
--- modules/image/image.test
+++ modules/image/image.test
@@ -734,7 +734,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
     $instance_settings = array(
       'alt_field' => 1,
       'file_extensions' => $test_image_extension,
-      'max_filesize' => '50 KB',
+      'max_filesize' => '50 kB',
       'max_resolution' => '100x100',
       'min_resolution' => '10x10',
       'title_field' => 1,
@@ -746,7 +746,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
     $instance = field_info_instance('node', $field_name, 'article');
 
     $this->drupalGet('node/add/article');
-    $this->assertText(t('Files must be less than 50 KB.'), t('Image widget max file size is displayed on article form.'));
+    $this->assertText(t('Files must be less than 50 kB.'), t('Image widget max file size is displayed on article form.'));
     $this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), t('Image widget allowed file types displayed on article form.'));
     $this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), t('Image widget allowed resolution displayed on article form.'));
 
diff --git modules/simpletest/simpletest.install modules/simpletest/simpletest.install
index 0f017e7..2b8f4bd 100644
--- modules/simpletest/simpletest.install
+++ modules/simpletest/simpletest.install
@@ -63,7 +63,7 @@ function simpletest_requirements($phase) {
   // Check the current memory limit. If it is set too low, SimpleTest will fail
   // to load all tests and throw a fatal error.
   $memory_limit = ini_get('memory_limit');
-  if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT)) {
+  if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit, TRUE) < parse_size(SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT, TRUE)) {
     $requirements['php_memory_limit']['severity'] = REQUIREMENT_ERROR;
     $requirements['php_memory_limit']['description'] = $t('The testing framework requires the PHP memory limit to be at least %memory_minimum_limit. The current value is %memory_limit. <a href="@url">Follow these steps to continue</a>.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT, '@url' => 'http://drupal.org/node/207036'));
   }
diff --git modules/simpletest/tests/common.test modules/simpletest/tests/common.test
index 4664f04..1af9a0b 100644
--- modules/simpletest/tests/common.test
+++ modules/simpletest/tests/common.test
@@ -413,21 +413,41 @@ class CommonSizeTestCase extends DrupalUnitTestCase {
   }
 
   function setUp() {
-    $kb = DRUPAL_KILOBYTE;
+    $kb = 1000;
     $this->exact_test_cases = array(
       '1 byte' => 1,
-      '1 KB'   => $kb,
-      '1 MB'   => $kb * $kb,
-      '1 GB'   => $kb * $kb * $kb,
-      '1 TB'   => $kb * $kb * $kb * $kb,
-      '1 PB'   => $kb * $kb * $kb * $kb * $kb,
-      '1 EB'   => $kb * $kb * $kb * $kb * $kb * $kb,
-      '1 ZB'   => $kb * $kb * $kb * $kb * $kb * $kb * $kb,
-      '1 YB'   => $kb * $kb * $kb * $kb * $kb * $kb * $kb * $kb,
+      '1 kB'   => 1000,
+      '1 MB'   => pow(1000, 2),
+      '1 GB'   => pow(1000, 3),
+      '1 TB'   => pow(1000, 4),
+      '1 PB'   => pow(1000, 5),
+      '1 EB'   => pow(1000, 6),
+      '1 ZB'   => pow(1000, 7),
+      '1 YB'   => pow(1000, 8),
+    );
+    $this->exact_iec_test_cases = array(
+      '1 KiB'   => 1024,
+      '1 MiB'   => pow(1024, 2),
+      '1 GiB'   => pow(1024, 3),
+      '1 TiB'   => pow(1024, 4),
+      '1 PiB'   => pow(1024, 5),
+      '1 EiB'   => pow(1024, 6),
+      '1 ZiB'   => pow(1024, 7),
+      '1 YiB'   => pow(1024, 8),
+    );
+    $this->exact_force_iec_test_cases = array(
+      '1 kB'   => 1024,
+      '1 MB'   => pow(1024, 2),
+      '1 GB'   => pow(1024, 3),
+      '1 TB'   => pow(1024, 4),
+      '1 PB'   => pow(1024, 5),
+      '1 EB'   => pow(1024, 6),
+      '1 ZB'   => pow(1024, 7),
+      '1 YB'   => pow(1024, 8),
     );
     $this->rounded_test_cases = array(
       '2 bytes' => 2,
-      '1 MB' => ($kb * $kb) - 1, // rounded to 1 MB (not 1000 or 1024 kilobyte!)
+      '1 MB' => pow(1000, 2) + 1, // rounded to 1 MB (not 1000 or 1024 kilobyte!)
       round(3623651 / ($this->exact_test_cases['1 MB']), 2) . ' MB' => 3623651, // megabytes
       round(67234178751368124 / ($this->exact_test_cases['1 PB']), 2) . ' PB' => 67234178751368124, // petabytes
       round(235346823821125814962843827 / ($this->exact_test_cases['1 YB']), 2) . ' YB' => 235346823821125814962843827, // yottabytes
@@ -454,9 +474,19 @@ class CommonSizeTestCase extends DrupalUnitTestCase {
    * Check that parse_size() returns the proper byte sizes.
    */
   function testCommonParseSize() {
-    foreach ($this->exact_test_cases as $string => $size) {
+    foreach (array($this->exact_test_cases, $this->exact_iec_test_cases) as $test_cases) {
+      foreach ($test_cases as $string => $size) {
+        $this->assertEqual(
+          $parsed_size = parse_size($string),
+          $size,
+          $size . ' == ' . $parsed_size . ' (' . $string . ')'
+        );
+      }
+    }
+
+    foreach ($this->exact_force_iec_test_cases as $string => $size) {
       $this->assertEqual(
-        $parsed_size = parse_size($string),
+        $parsed_size = parse_size($string, TRUE),
         $size,
         $size . ' == ' . $parsed_size . ' (' . $string . ')'
       );
@@ -472,13 +502,13 @@ class CommonSizeTestCase extends DrupalUnitTestCase {
     $string = '76MRandomStringThatShouldBeIgnoredByParseSize.'; // 76 MB
     $this->assertEqual(
       $parsed_size = parse_size($string),
-      $size = 79691776,
+      $size = 76000000,
       $string . ' == ' . $parsed_size . ' bytes'
     );
-    $string = '76.24 Giggabyte'; // Misspeld text -> 76.24 GB
+    $string = '76.24 Gubibytes'; // Misspeld text -> 76.24 GiB
     $this->assertEqual(
       $parsed_size = parse_size($string),
-      $size = 81862076662,
+      $size = 81862076661,
       $string . ' == ' . $parsed_size . ' bytes'
     );
   }
diff --git modules/simpletest/tests/xmlrpc.test modules/simpletest/tests/xmlrpc.test
index b2aa928..3751792 100644
--- modules/simpletest/tests/xmlrpc.test
+++ modules/simpletest/tests/xmlrpc.test
@@ -207,7 +207,7 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase {
       $xml_message_l = xmlrpc_test_message_sized_in_kb($size);
       $xml_message_r = xmlrpc($xml_url, array('messages.messageSizedInKB' => array($size)));
 
-      $this->assertEqual($xml_message_l, $xml_message_r, t('XML-RPC messages.messageSizedInKB of %s Kb size received', array('%s' => $size)));
+      $this->assertEqual($xml_message_l, $xml_message_r, t('XML-RPC messages.messageSizedInKB of %s kB size received', array('%s' => $size)));
     }
   }
 
diff --git modules/simpletest/tests/xmlrpc_test.module modules/simpletest/tests/xmlrpc_test.module
index db8f113..9b7c363 100644
--- modules/simpletest/tests/xmlrpc_test.module
+++ modules/simpletest/tests/xmlrpc_test.module
@@ -86,10 +86,10 @@ function xmlrpc_test_xmlrpc_alter(&$services) {
 }
 
 /**
- * Created a message of the desired size in KB.
+ * Created a message of the desired size in kB.
  *
  * @param $size
- *   Message size in KB.
+ *   Message size in kB.
  * @return array
  *   Generated message structure.
  */
@@ -98,7 +98,7 @@ function xmlrpc_test_message_sized_in_kb($size) {
 
   $word = 'abcdefg';
 
-  // Create a ~1KB sized struct.
+  // Create a ~1kB sized struct.
   for ($i = 0 ; $i < 128; $i++) {
     $line['word_' . $i] = $word;
   }
diff --git modules/system/system.install modules/system/system.install
index c89ce4f..2d35847 100644
--- modules/system/system.install
+++ modules/system/system.install
@@ -208,7 +208,7 @@ function system_requirements($phase) {
     'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
   );
 
-  if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
+  if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit, TRUE) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, TRUE)) {
     $description = '';
     if ($phase == 'install') {
       $description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
diff --git modules/user/user.admin.inc modules/user/user.admin.inc
index 0596bde..83df493 100644
--- modules/user/user.admin.inc
+++ modules/user/user.admin.inc
@@ -411,7 +411,7 @@ function user_admin_settings() {
     '#default_value' => variable_get('user_picture_file_size', '30'),
     '#size' => 10,
     '#maxlength' => 10,
-    '#field_suffix' => ' ' . t('KB'),
+    '#field_suffix' => ' ' . t('kB'),
     '#description' => t('Maximum allowed file size for uploaded pictures. Upload size is normally limited only by the PHP maximum post and file upload settings, and images are automatically scaled down to the dimensions specified above.'),
   );
   $form['personalization']['pictures']['user_picture_guidelines'] = array(
diff --git modules/user/user.test modules/user/user.test
index 3c453a8..4cb7077 100644
--- modules/user/user.test
+++ modules/user/user.test
@@ -910,7 +910,7 @@ class UserPictureTestCase extends DrupalWebTestCase {
       $this->drupalLogin($this->user);
 
       // Images are sorted first by size then by name. We need an image
-      // bigger than 1 KB so we'll grab the last one.
+      // bigger than 1 kB so we'll grab the last one.
       $files = $this->drupalGetTestFiles('image');
       $image = end($files);
       $info = image_get_info($image->uri);
