<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Decimal/formatted(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So9NSDecimala10FoundationE9formattedy12FormatOutputQzxAC0D5StyleRzAB0D5InputRtzlF"
  },
  "title" : "formatted(_:)"
}
-->

# formatted(_:)

Formats the decimal using the provided format style.

```
func formatted<S>(_ format: S) -> S.FormatOutput where S : FormatStyle, S.FormatInput == Decimal
```

## Parameters

`format`

The format style to apply when formatting the decimal.

## Return Value

A localized, formatted string representation of the decimal.

## Discussion

Use this method when you want to format a single decimal value with a specific format style or multiple format styles. The following example shows the results of formatting a given decimal value with format styles for the `en_US` and `fr_FR` locales:

```swift
let decimal: Decimal = 123456.789
let usStyle = Decimal.FormatStyle(locale: Locale(identifier: "en_US"))
let frStyle = Decimal.FormatStyle(locale: Locale(identifier: "fr_FR"))
let formattedUS = decimal.formatted(usStyle) // 123,456.789
let formattedFR = decimal.formatted(frStyle) // 123 456,789
```

---

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)