<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSSize",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSSize"
  },
  "title" : "NSSize"
}
-->

# NSSize

A two-dimensional size.

```
typealias NSSize = CGSize
```

## Discussion

Normally, the values of `width` and `height` are non-negative. The functions that create an `NSSize` structure do not prevent you from setting a negative value for these attributes. If the value of `width` or `height` is negative, however, the behavior of some methods may be undefined.

### Special Considerations

Prior to OS X v10.5 the width and height were represented by `float` values rather than `CGFloat` values.

When building for 64 bit systems, or building 32 bit like 64 bit, `NSSize` is typedef’d to `CGSize`.

## Topics

### Managing Sizes

[`NSEqualSizes`](/documentation/Foundation/NSEqualSizes(_:_:))

Returns a Boolean that indicates whether two size values are equal.

[`NSMakeSize`](/documentation/Foundation/NSMakeSize(_:_:))

Returns a new `NSSize` from the specified values.

[`NSSizeFromString`](/documentation/Foundation/NSSizeFromString(_:))

Returns an `NSSize` from a text-based representation.

[`NSStringFromSize`](/documentation/Foundation/NSStringFromSize(_:))

Returns a string representation of a size.

[`NSSizeFromCGSize`](/documentation/Foundation/NSSizeFromCGSize(_:))

Returns an `NSSize` typecast from a `CGSize`.

[`NSSizeToCGSize`](/documentation/Foundation/NSSizeToCGSize(_:))

Returns a `CGSize` typecast from an `NSSize`.

### Zero Constant

[`NSZeroSize`](/documentation/Foundation/NSZeroSize)

An `NSSize` structure set to `0` in both dimensions.

### Related Types

[`NSSizeArray`](/documentation/Foundation/NSSizeArray)

Type indicating a parameter is an array of `NSSize` structures.

[`NSSizePointer`](/documentation/Foundation/NSSizePointer)

Type indicating parameter is a pointer to an `NSSize` structure.



---

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)