<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/byte-order-utilities",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Byte Order Utilities"
}
-->

# Byte Order Utilities

Examine and manage the byte order of numbers communicated through network channels.

## Topics

### Functions

[`func NSConvertHostDoubleToSwapped(Double) -> NSSwappedDouble`](/documentation/Foundation/NSConvertHostDoubleToSwapped(_:))

Performs a type conversion.

[`func NSConvertHostFloatToSwapped(Float) -> NSSwappedFloat`](/documentation/Foundation/NSConvertHostFloatToSwapped(_:))

Performs a type conversion.

[`func NSConvertSwappedDoubleToHost(NSSwappedDouble) -> Double`](/documentation/Foundation/NSConvertSwappedDoubleToHost(_:))

Performs a type conversion.

[`func NSConvertSwappedFloatToHost(NSSwappedFloat) -> Float`](/documentation/Foundation/NSConvertSwappedFloatToHost(_:))

Performs a type conversion.

[`func NSHostByteOrder() -> Int`](/documentation/Foundation/NSHostByteOrder())

Returns the endian format.

[`func NSSwapBigDoubleToHost(NSSwappedDouble) -> Double`](/documentation/Foundation/NSSwapBigDoubleToHost(_:))

Swaps the bytes of a number.

[`func NSSwapBigFloatToHost(NSSwappedFloat) -> Float`](/documentation/Foundation/NSSwapBigFloatToHost(_:))

Swaps the bytes of a number.

[`func NSSwapBigIntToHost(UInt32) -> UInt32`](/documentation/Foundation/NSSwapBigIntToHost(_:))

Swaps the bytes of a number.

[`func NSSwapBigLongLongToHost(UInt64) -> UInt64`](/documentation/Foundation/NSSwapBigLongLongToHost(_:))

Swaps the bytes of a number.

[`func NSSwapBigLongToHost(UInt) -> UInt`](/documentation/Foundation/NSSwapBigLongToHost(_:))

Swaps the bytes of a number.

[`func NSSwapBigShortToHost(UInt16) -> UInt16`](/documentation/Foundation/NSSwapBigShortToHost(_:))

Swaps the bytes of a number.

[`func NSSwapDouble(NSSwappedDouble) -> NSSwappedDouble`](/documentation/Foundation/NSSwapDouble(_:))

Swaps the bytes of a number.

[`func NSSwapFloat(NSSwappedFloat) -> NSSwappedFloat`](/documentation/Foundation/NSSwapFloat(_:))

Swaps the bytes of a number.

[`func NSSwapHostDoubleToBig(Double) -> NSSwappedDouble`](/documentation/Foundation/NSSwapHostDoubleToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostDoubleToLittle(Double) -> NSSwappedDouble`](/documentation/Foundation/NSSwapHostDoubleToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapHostFloatToBig(Float) -> NSSwappedFloat`](/documentation/Foundation/NSSwapHostFloatToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostFloatToLittle(Float) -> NSSwappedFloat`](/documentation/Foundation/NSSwapHostFloatToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapHostIntToBig(UInt32) -> UInt32`](/documentation/Foundation/NSSwapHostIntToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostIntToLittle(UInt32) -> UInt32`](/documentation/Foundation/NSSwapHostIntToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapHostLongLongToBig(UInt64) -> UInt64`](/documentation/Foundation/NSSwapHostLongLongToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostLongLongToLittle(UInt64) -> UInt64`](/documentation/Foundation/NSSwapHostLongLongToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapHostLongToBig(UInt) -> UInt`](/documentation/Foundation/NSSwapHostLongToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostLongToLittle(UInt) -> UInt`](/documentation/Foundation/NSSwapHostLongToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapHostShortToBig(UInt16) -> UInt16`](/documentation/Foundation/NSSwapHostShortToBig(_:))

Swaps the bytes of a number.

[`func NSSwapHostShortToLittle(UInt16) -> UInt16`](/documentation/Foundation/NSSwapHostShortToLittle(_:))

Swaps the bytes of a number.

[`func NSSwapInt(UInt32) -> UInt32`](/documentation/Foundation/NSSwapInt(_:))

Swaps the bytes of a number.

[`func NSSwapLittleDoubleToHost(NSSwappedDouble) -> Double`](/documentation/Foundation/NSSwapLittleDoubleToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLittleFloatToHost(NSSwappedFloat) -> Float`](/documentation/Foundation/NSSwapLittleFloatToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLittleIntToHost(UInt32) -> UInt32`](/documentation/Foundation/NSSwapLittleIntToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLittleLongLongToHost(UInt64) -> UInt64`](/documentation/Foundation/NSSwapLittleLongLongToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLittleLongToHost(UInt) -> UInt`](/documentation/Foundation/NSSwapLittleLongToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLittleShortToHost(UInt16) -> UInt16`](/documentation/Foundation/NSSwapLittleShortToHost(_:))

Swaps the bytes of a number.

[`func NSSwapLong(UInt) -> UInt`](/documentation/Foundation/NSSwapLong(_:))

Swaps the bytes of a number.

[`func NSSwapLongLong(UInt64) -> UInt64`](/documentation/Foundation/NSSwapLongLong(_:))

Swaps the bytes of a number.

[`func NSSwapShort(UInt16) -> UInt16`](/documentation/Foundation/NSSwapShort(_:))

Swaps the bytes of a number.

### Constants

[`struct NSSwappedDouble`](/documentation/Foundation/NSSwappedDouble)

Opaque structure containing endian-independent `double` value.

[`struct NSSwappedFloat`](/documentation/Foundation/NSSwappedFloat)

Opaque type containing an endian-independent `float` value.

[Byte Order](/documentation/Foundation/byte-order-constants)

Recognize constants that specify a byte-order format.



---

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)