---
title: asciiValue
framework: swift
role: symbol
role_heading: Instance Property
path: swift/character/asciivalue
---

# asciiValue

The ASCII encoding value of this character, if it is an ASCII character.

## Declaration

```swift
var asciiValue: UInt8? { get }
```

## Discussion

Discussion let chars: [Character] = ["a", " ", "™"] for ch in chars {     print(ch, "-->", ch.asciiValue) } // Prints: // a --> Optional(97) //   --> Optional(32) // ™ --> nil A character with the value “\r\n” (CR-LF) is normalized to “\n” (LF) and has an asciiValue property equal to 10. let cr = "\r" as Character // cr.asciiValue == 13 let lf = "\n" as Character // lf.asciiValue == 10 let crlf = "\r\n" as Character // crlf.asciiValue == 10

## See Also

### Working with a Character’s Unicode Values

- [init(_:)](swift/character/init(_:)-8hq6x.md)
- [unicodeScalars](swift/character/unicodescalars.md)
- [Character.UnicodeScalarView](swift/character/unicodescalarview.md)
- [isASCII](swift/character/isascii.md)
