Cypher expressions

This page contains examples of allowed expressions in Cypher®.


  • A variable: n, x, rel, myFancyVariable, `A name with special characters in it[]!`.

  • A property: n.prop, x.prop, rel.thisProperty, myFancyVariable.`(special property name)`.

  • A dynamic property: n["prop"], rel[ +], map[coll[0]].

  • A parameter: $param, $0.

  • A list of expressions: ['a', 'b'], [1, 2, 3], ['a', 2,, $param], [].

  • A function call: length(p), nodes(p).

  • An aggregate function call: avg(x.prop), count(*).

  • A path-pattern: (a)-[r]->(b), (a)-[r]-(b), (a)--(b), (a)-->()<--(b).

  • An operator application: 1 + 2, 3 < 4.

  • A subquery expression: COUNT {}, COLLECT {}, EXISTS {}, CALL {}.

  • A regular expression: =~ 'Tim.*'.

  • A CASE expression.

  • null.

Expressions containing unsanitized user input may make your application vulnerable to Cypher injection. Consider using parameters instead. Learn more in Protecting against Cypher Injection.

Most expressions in Cypher evaluate to null if any of their inner expressions are null. Notable exceptions are the operators IS NULL, IS NOT NULL, and the type predicate expressions.


  • A numeric (INTEGER or FLOAT) literal: 13, -40000, 3.14.

  • A numeric (INTEGER or FLOAT) literal in scientific notation: 6.022E23.

  • A hexadecimal INTEGER literal (starting with 0x): 0x13af, 0xFC3A9, -0x66eff.

  • An octal INTEGER literal (starting with 0o): 0o1372, -0o5671.

  • A FLOAT literal: Inf, Infinity, NaN.

  • null.

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.


  • A STRING literal: 'Hello', "World".

  • A case-sensitive STRING matching expression: a.surname STARTS WITH 'Sven', a.surname ENDS WITH 'son' or a.surname CONTAINS 'son'.

  • null.

String literal escape sequences

String literals can contain the following escape sequences:

Escape sequence Character








Carriage return


Form feed


Single quote


Double quote




Unicode UTF-16 code point (4 hex digits must follow the \u)


  • A BOOLEAN literal: true, false.

  • A predicate expression (i.e. an expression returning a BOOLEAN value): a.prop = 'Hello', length(p) > 10, IS NOT NULL.

  • Label and relationship type expressions: (n:A|B), ()-[r:R1|R2]->().

  • null.