Skip to content
BEAD

SQL Escape / Unescape

Safely quote string literals for ANSI, MySQL, or PostgreSQL — and reverse it.

Safe SQL literal

What we escape

  • ' single quote — doubled to '' (SQL standard)
  • \ backslash — for engines that treat it as an escape (MySQL default)
  • Control characters — \0 \n \r \t \b for MySQL strings

Use a parameterized query when you can

String escaping is a last resort. Parameter binding (?, $1, :name) is safer because the driver handles types and never inlines values into the SQL text.

You might also like