<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Font/monospacedDigit()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4FontV15monospacedDigitACyF"
  },
  "title" : "monospacedDigit()"
}
-->

# monospacedDigit()

Returns a modified font that uses fixed-width digits, while leaving
other characters proportionally spaced.

```
func monospacedDigit() -> Font
```

## Return Value

A font that uses fixed-width numeric characters.

## Discussion

This modifier only affects numeric characters, and leaves all other
characters unchanged. If the base font doesn’t support fixed-width,
or *monospace* digits, the font remains unchanged.

The following example shows two text fields arranged in a [`VStack`](/documentation/SwiftUI/VStack).
Both text fields specify the 12-point system font, with the second
adding the `monospacedDigit()` modifier to the font. Because the text
includes the digit 1, normally a narrow character in proportional
fonts, the second text field becomes wider than the first.

```
@State private var userText = "Effect of monospacing digits: 111,111."

var body: some View {
    VStack {
        TextField("Proportional", text: $userText)
            .font(.system(size: 12))
        TextField("Monospaced", text: $userText)
            .font(.system(size: 12).monospacedDigit())
    }
    .padding()
    .navigationTitle(Text("Font + monospacedDigit()"))
}
```

![A macOS window showing two text fields arranged vertically. Each](images/com.apple.SwiftUI/Environment-Font-monospacedDigit-1@2x.png)

---

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)