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

# relativePath

The relative path of the URL if the URL conforms to RFC 3986, otherwise nil.

## Declaration

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

## Return Value

Return Value The relative path, or an empty string if the URL has an empty path.

## Discussion

Discussion note: This function resolve against the base URL.

## See Also

### Accessing URL representations

- [baseURL](foundation/url/baseurl.md)
- [absoluteString](foundation/url/absolutestring.md)
- [absoluteURL](foundation/url/absoluteurl.md)
- [relativeString](foundation/url/relativestring.md)
- [standardized](foundation/url/standardized.md)
- [standardizedFileURL](foundation/url/standardizedfileurl.md)
