<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFNumberFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFNumberFormatterRef"
  },
  "title" : "CFNumberFormatter"
}
-->

# CFNumberFormatter

```
class CFNumberFormatter
```

## Overview

CFNumberFormatter objects format the textual representations of CFNumber objects, and convert textual representations of numbers into CFNumber objects. The representation encompasses integers, floats, and doubles; floats and doubles can be formatted to a specified decimal position. You specify how strings are formatted and parsed by setting a format string and other properties of a CFNumberFormatter object.

The format of the format string is defined by Unicode Technical Standard #35; the version of the standard used varies with release of the operating system, and is described in [Introduction to Data Formatting Programming Guide For Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DataFormatting/DataFormatting.html#//apple_ref/doc/uid/10000029).

> Important:
> `CFNumberFormatter` is not thread-safe.  Do not use a single instance from multiple threads.

Unlike some other Core Foundation opaque types with names similar to a corresponding Cocoa Foundation class (such as CFString and `NSString`), CFNumberFormatter objects cannot be cast (“toll-free bridged”) to `NSNumberFormatter` objects.

## Topics

### Creating a Number Formatter

[`CFNumberFormatterCreate(_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterCreate(_:_:_:))

Creates a new CFNumberFormatter object, localized to the given locale, which will format numbers to the given style.

### Configuring a Number Formatter

[`CFNumberFormatterSetFormat(_:_:)`](/documentation/CoreFoundation/CFNumberFormatterSetFormat(_:_:))

Sets the format string of a number formatter.

[`CFNumberFormatterSetProperty(_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterSetProperty(_:_:_:))

Sets a number formatter property using a key-value pair.

### Formatting Values

[`CFNumberFormatterCreateNumberFromString(_:_:_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterCreateNumberFromString(_:_:_:_:_:))

Returns a number object representing a given string.

[`CFNumberFormatterCreateStringWithNumber(_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterCreateStringWithNumber(_:_:_:))

Returns a string representation of the given number using the specified number formatter.

[`CFNumberFormatterCreateStringWithValue(_:_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterCreateStringWithValue(_:_:_:_:))

Returns a string representation of the given number or value using the specified number formatter.

[`CFNumberFormatterGetDecimalInfoForCurrencyCode(_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterGetDecimalInfoForCurrencyCode(_:_:_:))

Returns the number of fraction digits that should be displayed, and the rounding increment, for a given currency.

[`CFNumberFormatterGetValueFromString(_:_:_:_:_:)`](/documentation/CoreFoundation/CFNumberFormatterGetValueFromString(_:_:_:_:_:))

Returns a number or value representing a given string.

### Examining a Number Formatter

[`CFNumberFormatterCopyProperty(_:_:)`](/documentation/CoreFoundation/CFNumberFormatterCopyProperty(_:_:))

Returns a copy of a number formatter’s value for a given key.

[`CFNumberFormatterGetFormat(_:)`](/documentation/CoreFoundation/CFNumberFormatterGetFormat(_:))

Returns a format string for the given number formatter object.

[`CFNumberFormatterGetLocale(_:)`](/documentation/CoreFoundation/CFNumberFormatterGetLocale(_:))

Returns the locale object used to create the given number formatter object.

[`CFNumberFormatterGetStyle(_:)`](/documentation/CoreFoundation/CFNumberFormatterGetStyle(_:))

Returns the number style used to create the given number formatter object.

### Getting the CFNumberFormatter Type ID

[`CFNumberFormatterGetTypeID()`](/documentation/CoreFoundation/CFNumberFormatterGetTypeID())

Returns the type identifier for the `CFNumberFormatter` opaque type.

### Data Types

[`CFNumberFormatterStyle`](/documentation/CoreFoundation/CFNumberFormatterStyle)

Type for constants specifying a formatter style.

[`CFNumberFormatterOptionFlags`](/documentation/CoreFoundation/CFNumberFormatterOptionFlags)

Type for constants specifying how numbers should be parsed.

[`CFNumberFormatterPadPosition`](/documentation/CoreFoundation/CFNumberFormatterPadPosition)

Type for constants specifying how numbers should be padded.

### Constants

[Number Formatter Styles](/documentation/CoreFoundation/number-formatter-styles)

Predefined number format styles.

[Number Formatter Property Keys](/documentation/CoreFoundation/number-formatter-property-keys)

The keys used in key-value pairs to specify the value of number formatter properties.

[Number Format Options](/documentation/CoreFoundation/number_format_options)

These constants are used to specify how numbers should be parsed.

[`CFNumberFormatterRoundingMode`](/documentation/CoreFoundation/CFNumberFormatterRoundingMode)

These constants are used to specify how numbers should be rounded.

[Padding Positions](/documentation/CoreFoundation/padding-positions)

These constants are used to specify how numbers should be padded.

## See Also

  [Data Formatting Guide for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFDataFormatting/Articles/CFDataFormatting.html#//apple_ref/doc/uid/10000176i)



---

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)