<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/MassFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMassFormatter"
  },
  "title" : "MassFormatter"
}
-->

# MassFormatter

A formatter that provides localized descriptions of mass and weight values.

```
class MassFormatter
```

## Overview> Note:
> As of iOS 10, macOS 10.12, tvOS 10, and watchOS 3, Foundation provides the ``doc://com.apple.foundation/documentation/Foundation/MeasurementFormatter`` class, which can be used to represent quantities of ``doc://com.apple.foundation/documentation/Foundation/UnitMass`` to provide equivalent functionality to ``doc://com.apple.foundation/documentation/Foundation/MassFormatter``. You are encouraged to transition to these new Foundation Units and Measurements APIs whenever possible.

## Topics

### Formatting Mass Strings

[`isForPersonMassUse`](/documentation/Foundation/MassFormatter/isForPersonMassUse)

A Boolean value that indicates whether the resulting string represents a person’s mass.

[`getObjectValue(_:for:errorDescription:)`](/documentation/Foundation/MassFormatter/getObjectValue(_:for:errorDescription:))

This method is not supported for the `NSMassFormatter` class.

[`numberFormatter`](/documentation/Foundation/MassFormatter/numberFormatter)

The number formatter used to format the numbers in a mass strings.

[`string(fromKilograms:)`](/documentation/Foundation/MassFormatter/string(fromKilograms:))

Returns a mass string for the provided value.

[`string(fromValue:unit:)`](/documentation/Foundation/MassFormatter/string(fromValue:unit:))

Returns a properly formatted mass string for the given value and unit.

[`unitString(fromKilograms:usedUnit:)`](/documentation/Foundation/MassFormatter/unitString(fromKilograms:usedUnit:))

Returns the unit string for the provided value.

[`unitString(fromValue:unit:)`](/documentation/Foundation/MassFormatter/unitString(fromValue:unit:))

Returns the unit string based on the provided value and unit.

[`unitStyle`](/documentation/Foundation/MassFormatter/unitStyle)

The unit style used by this formatter.

### Constants

[`MassFormatter.Unit`](/documentation/Foundation/MassFormatter/Unit)

The units supported by the `NSMassFormatter` class.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)