<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSEvent/characters(byApplyingModifiers:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSEvent(im)charactersByApplyingModifiers:"
  },
  "title" : "characters(byApplyingModifiers:)"
}
-->

# characters(byApplyingModifiers:)

Returns the new characters that result if you apply the specified modifier keys to the event.

```
func characters(byApplyingModifiers modifiers: NSEvent.ModifierFlags) -> String?
```

## Parameters

`modifiers`

The modifier keys you want to apply to the event’s characters. These modifiers completely replace the existing modifiers in the event.

## Return Value

The characters that result from the application of the specified modifier keys. If the event contains invalid data, this method returns `nil`.

## Discussion

Call this method to determine what characters occur if you apply the specified modifier keys to this event. This method doesn’t modify the event itself, but returns a translation of the event’s data that replaces the existing modifier keys with the new ones you specify. Cal this method only for an event of type [`NSEvent.EventType.keyUp`](/documentation/AppKit/NSEvent/EventType/keyUp) or [`NSEvent.EventType.keyDown`](/documentation/AppKit/NSEvent/EventType/keyDown).

---

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)