SQL unescape for dumps, logs and scripts
SQL dumps, query logs and generated migration files contain values in escaped form. The SQL unescape tool turns them back into readable text so you can inspect a value, copy it into a document or compare it with what the application stored.
Dialects
Standard SQL
Replaces every '' with a single '. That is the only escape in standard SQL, used by PostgreSQL, SQL Server, Oracle and SQLite.
MySQL (backslash)
Decodes the backslash sequences written by mysqldump and mysql_real_escape_string: \', \", \\, \0, \n, \r, \t, \b and \Z (Ctrl+Z). Doubled quotes are also collapsed, because MySQL accepts both styles.
Two sequences are intentionally kept: \% and \_. MySQL leaves the backslash in place for these so they still work as literal wildcards in LIKE patterns.
Example (MySQL mode)
Input:
It\'s O\'Brien\'s \"C:\\temp\"\nnext lineOutput:
It's O'Brien's "C:\temp"
next line
Example (standard SQL)
Input:
Tom''s ''special'' orderOutput:
Tom's 'special' orderStandard mode only touches doubled quotes, so backslashes, % signs and double quotes stay exactly as they are.
Typical uses
- Reading a dump. Copy a long text value out of an
INSERTstatement in a backup file to see it with real line breaks. - Comparing data. Check whether a value in a migration script matches what users see in the application, without guessing how many quotes are escapes.
- Debugging query logs. Slow-query and general logs record statements with values inlined and escaped; unescaping makes long text values readable.
- Cleaning exports. Turn escaped values from a SQL export into plain text for a document or spreadsheet.
Paste only the contents of the literal — the part between the outer quotes. If you include the outer quotes, they stay in the output as ordinary characters.
Choosing the right mode
If the text contains backslash sequences such as \n and came from MySQL or MariaDB, use MySQL mode. For PostgreSQL pg_dump output or SQL Server scripts, use Standard SQL: in those databases a backslash is an ordinary character, and decoding it would change your data.
Escape text again with SQL Escape or reformat a whole dump with the SQL Formatter. Remember that when you write values back to a database from code, parameterised queries are the safe route rather than re-escaping by hand. Processing happens in your browser.