Boolean, numeric, and string literals
This page describes the literal forms of numerical (INTEGER and FLOAT), STRING, and BOOLEAN values in expressions.
| Expressions containing unsanitized user input may make your application vulnerable to Cypher® injection. Consider using parameters instead. For more information, see Neo4j Knowledge Base → Protecting against Cypher Injection. |
Boolean
Boolean literals represent BOOLEAN values.
A boolean literal may be written as:
-
The literal
true -
The literal
false
Numerical
Numerical literals can represent INTEGER or FLOAT values.
A numerical literal may be written as:
-
A decimal
INTEGERliteral:13,-40000 -
A hexadecimal
INTEGERliteral (prefix0x):0x13af,0xFC3A9,-0x66eff -
An octal
INTEGERliteral (prefix0o):0o1372,-0o5671
-
A
FLOATliteral in common notation:3.14 -
A
FLOATliteral in scientific notation:6.022E23,1e-9 -
Literals for special
FLOATvalues:Inf,Infinity,NaN
Any numeric literal may contain an underscore _ between digits.
There may be an underscore between the 0x or 0o and the digits for hexadecimal and octal literals.
For example: 1_000_000, 0x_FC3A9, and 0o_1372.
|
String
String literals represent STRING values.
They are written using single(') or double quotes (") and may contain escape sequences using a backslash (\).
A string literal may be written as:
-
A
STRINGquoted with single quotes:'Hello, 42' -
A
STRINGquoted with double quotes:"Hello, 42" -
A
STRINGwith whitespace:' hello ' -
A
STRINGwith escape sequences:'Line 1\nLine 2','Tab\tseparated' -
A
STRINGcontaining Unicode characters:'그래프는 어디에나 있다' -
A
STRINGusing a Unicode code point:'Name: \u004Aohn'(produces'Name: John')
String literal escape sequences
String literals can contain the following escape sequences:
| Escape sequence | Character |
|---|---|
|
Tab |
|
Backspace |
|
Newline |
|
Carriage return |
|
Form feed |
|
Single quote |
|
Double quote |
|
Backslash |
|
Unicode UTF-16 code point (4 hex digits must follow the |
String interpolationCypher 25 onlyIntroduced in Neo4j 2026.08
String interpolation lets one or more expressions be embedded directly inside a string literal.
Each embedded expression is evaluated and inserted into the resulting STRING, so the string does not need to be built up manually with the string concatenation operators.
An interpolated string is written by prefixing a quoted string with s or S, and wrapping each expression to be evaluated in curly braces ({ and }):
-
s"Hello, {p.name}" -
S’Hello, {p.name}'
Interpolated strings can be quoted with either single or double quotes, following the same quoting rules as string literals, and may contain any number of {expression} placeholders.
Every embedded expression is automatically converted to a STRING using toString().
Because toString() does not support them, expressions that evaluate to MAP, LIST, NODE, PATH, or RELATIONSHIP values cannot be used inside an interpolated expression.
To include a literal curly brace in an interpolated string, escape it with a backslash: \{ or \}.
|
Take care when using string interpolation to build Cypher strings that get passed into plugin procedures which execute dynamic Cypher, such as |
Examples
CREATE (p:Person {name: 'Alice'})
RETURN s"Hello, {p.name}!" AS greeting
| greeting |
|---|
|
Rows: 1 |
WITH 'Keanu' AS firstName, 'Reeves' AS lastName
RETURN s"{firstName} {lastName}" AS fullName
| fullName |
|---|
|
Rows: 1 |
Non-STRING values are automatically converted using toString().
STRING valueWITH 42 AS age
RETURN s"Age: {age}" AS result
| result |
|---|
|
Rows: 1 |
RETURN s"Use \{curly\} braces" AS result
| result |
|---|
|
Rows: 1 |
Interpolated strings can be nested, since an embedded expression may itself be an interpolated string.
WITH 'World' AS name
RETURN s"Outer: {s'Inner, {name}!'}" AS result
| result |
|---|
|
Rows: 1 |