<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSString/smallestEncoding",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSString(py)smallestEncoding"
  },
  "title" : "smallestEncoding"
}
-->

# smallestEncoding

The smallest encoding to which the receiver can be converted without loss of information.

```
var smallestEncoding: UInt { get }
```

## Discussion

This encoding may not be the fastest for accessing characters, but is space-efficient. This property may take some time to access.

## See Also

[`getCharacters(_:range:)`](/documentation/Foundation/NSString/getCharacters(_:range:))

Copies characters from a given range in the receiver into a given buffer.



---

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)