<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextInput/markedRange",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextInput(im)markedRange"
  },
  "title" : "markedRange"
}
-->

# markedRange

Returns the range of the marked text.

```
- (NSRange) markedRange;
```

## Return Value

The range of marked text.

## Discussion

The returned range measures from the start of the receiver’s text storage. The return value’s `location` is `NSNotFound`, and its `length` is 0 if and only if [`hasMarkedText`](/documentation/AppKit/NSTextInput/hasMarkedText) returns <doc://com.apple.documentation/documentation/Swift/false>.

---

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)