---
title: relativePath
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsurl/relativepath
---

# relativePath

The relative path, conforming to RFC 1808. (read-only)

## Declaration

```swift
var relativePath: String? { get }
```

## Discussion

Discussion This property contains the relative path of the receiver’s URL without resolving against its base URL. Any percent-encoded characters are not unescaped. If the path has a trailing slash it is stripped. If the receiver is an absolute URL, this property contains the same value as path. If the receiver does not conform to RFC 1808, it contains nil.

## See Also

### Accessing the Parts of the URL

- [absoluteString](foundation/nsurl/absolutestring.md)
- [absoluteURL](foundation/nsurl/absoluteurl.md)
- [baseURL](foundation/nsurl/baseurl.md)
- [fileSystemRepresentation](foundation/nsurl/filesystemrepresentation.md)
- [fragment](foundation/nsurl/fragment.md)
- [host](foundation/nsurl/host.md)
- [lastPathComponent](foundation/nsurl/lastpathcomponent.md)
- [parameterString](foundation/nsurl/parameterstring.md)
- [password](foundation/nsurl/password.md)
- [path](foundation/nsurl/path.md)
- [pathComponents](foundation/nsurl/pathcomponents.md)
- [pathExtension](foundation/nsurl/pathextension.md)
- [port](foundation/nsurl/port.md)
- [query](foundation/nsurl/query.md)
- [relativeString](foundation/nsurl/relativestring.md)
