<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UnitLength",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUnitLength"
  },
  "title" : "UnitLength"
}
-->

# UnitLength

A unit of measure for length.

```
class UnitLength
```

## Overview

You typically use instances of [`UnitLength`](/documentation/Foundation/UnitLength) to represent specific quantities of length using the [`NSMeasurement`](/documentation/Foundation/NSMeasurement) class.

### Length

Length is the dimensional extent of matter. The SI unit for length is the meter (m), which is defined in terms of the distance traveled by light in a vacuum.

The [`UnitLength`](/documentation/Foundation/UnitLength) class defines its [`baseUnit()`](/documentation/Foundation/Dimension/baseUnit()) as [`meters`](/documentation/Foundation/UnitLength/meters), and provides the following units, which are initialized using [`UnitConverterLinear`](/documentation/Foundation/UnitConverterLinear) converters with the specified coefficients:

|Name              |Method                                                                              |Symbol|Coefficient|
|------------------|------------------------------------------------------------------------------------|------|-----------|
|Megameters        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/megameters``       |Mm    |`1000000.0`|
|Kilometers        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/kilometers``       |kM    |`1000.0`   |
|Hectometers       |``doc://com.apple.foundation/documentation/Foundation/UnitLength/hectometers``      |hm    |`100.0`    |
|Decameters        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/decameters``       |dam   |`10.0`     |
|Meters            |``doc://com.apple.foundation/documentation/Foundation/UnitLength/meters``           |m     |`1.0`      |
|Decimeters        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/decimeters``       |dm    |`0.1`      |
|Centimeters       |``doc://com.apple.foundation/documentation/Foundation/UnitLength/centimeters``      |cm    |`0.01`     |
|Millimeters       |``doc://com.apple.foundation/documentation/Foundation/UnitLength/millimeters``      |mm    |`0.001`    |
|Micrometers       |``doc://com.apple.foundation/documentation/Foundation/UnitLength/micrometers``      |µm    |`0.000001` |
|Nanometers        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/nanometers``       |nm    |`1e-9`     |
|Picometers        |``doc://com.apple.foundation/documentation/Foundation/UnitLength/picometers``       |pm    |`1e-12`    |
|Inches            |``doc://com.apple.foundation/documentation/Foundation/UnitLength/inches``           |in    |`0.0254`   |
|Feet              |``doc://com.apple.foundation/documentation/Foundation/UnitLength/feet``             |ft    |`0.3048`   |
|Yards             |``doc://com.apple.foundation/documentation/Foundation/UnitLength/yards``            |yd    |`0.9144`   |
|Miles             |``doc://com.apple.foundation/documentation/Foundation/UnitLength/miles``            |mi    |`1609.34`  |
|Scandinavian Miles|``doc://com.apple.foundation/documentation/Foundation/UnitLength/scandinavianMiles``|smi   |`10000`    |
|Light Years       |``doc://com.apple.foundation/documentation/Foundation/UnitLength/lightyears``       |ly    |`9.461e+15`|
|Nautical Miles    |``doc://com.apple.foundation/documentation/Foundation/UnitLength/nauticalMiles``    |NM    |`1852`     |
|Fathoms           |``doc://com.apple.foundation/documentation/Foundation/UnitLength/fathoms``          |ftm   |`1.8288`   |
|Furlongs          |``doc://com.apple.foundation/documentation/Foundation/UnitLength/furlongs``         |fur   |`201.168`  |
|Astronomical Units|``doc://com.apple.foundation/documentation/Foundation/UnitLength/astronomicalUnits``|au    |`1.496e+11`|
|Parsecs           |``doc://com.apple.foundation/documentation/Foundation/UnitLength/parsecs``          |pc    |`3.086e+16`|

## Topics

### Accessing the Base Unit

[`+  baseUnit`](/documentation/Foundation/Dimension/baseUnit())

Returns the base unit.

### Accessing Predefined Units

[`megameters`](/documentation/Foundation/UnitLength/megameters)

The megameters unit of length.

[`kilometers`](/documentation/Foundation/UnitLength/kilometers)

The kilometers unit of length.

[`hectometers`](/documentation/Foundation/UnitLength/hectometers)

The hectometers unit of length.

[`decameters`](/documentation/Foundation/UnitLength/decameters)

The decameters unit of length.

[`meters`](/documentation/Foundation/UnitLength/meters)

The meters unit of length.

[`decimeters`](/documentation/Foundation/UnitLength/decimeters)

The decimeters unit of length.

[`centimeters`](/documentation/Foundation/UnitLength/centimeters)

The centimeters unit of length.

[`millimeters`](/documentation/Foundation/UnitLength/millimeters)

The millimeters unit of length.

[`micrometers`](/documentation/Foundation/UnitLength/micrometers)

The micrometers unit of length.

[`nanometers`](/documentation/Foundation/UnitLength/nanometers)

The nanometers unit of length.

[`picometers`](/documentation/Foundation/UnitLength/picometers)

The picometers unit of length.

[`inches`](/documentation/Foundation/UnitLength/inches)

The inches unit of length.

[`feet`](/documentation/Foundation/UnitLength/feet)

The feet unit of length.

[`yards`](/documentation/Foundation/UnitLength/yards)

The yards unit of length.

[`miles`](/documentation/Foundation/UnitLength/miles)

The miles unit of length.

[`scandinavianMiles`](/documentation/Foundation/UnitLength/scandinavianMiles)

The Scandinavian miles unit of length.

[`lightyears`](/documentation/Foundation/UnitLength/lightyears)

The light years unit of length.

[`nauticalMiles`](/documentation/Foundation/UnitLength/nauticalMiles)

The nautical miles unit of length.

[`fathoms`](/documentation/Foundation/UnitLength/fathoms)

The fathoms unit of length.

[`furlongs`](/documentation/Foundation/UnitLength/furlongs)

The furlongs unit of length.

[`astronomicalUnits`](/documentation/Foundation/UnitLength/astronomicalUnits)

The astronomical units unit of length.

[`parsecs`](/documentation/Foundation/UnitLength/parsecs)

The parsecs unit of length.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

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

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

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

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

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

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

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

---

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)