<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFStringGetSmallestEncoding(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFStringGetSmallestEncoding"
  },
  "title" : "CFStringGetSmallestEncoding(_:)"
}
-->

# CFStringGetSmallestEncoding(_:)

Returns the smallest encoding on the current system for the character contents of a string.

```
func CFStringGetSmallestEncoding(_ theString: CFString!) -> CFStringEncoding
```

## Parameters

`theString`

The string for which to find the smallest encoding.

## Return Value

The string encoding that has the smallest representation of `theString`.

## Discussion

This function returns the supported encoding that requires the least space (in terms of bytes needed to represent one character) to represent the character contents of a string. This information is not always immediately available, so this function might need to compute it.

---

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)