Loading Base64 to SQL Converter...

How to Convert Base64 to SQL

SQL gets wrapped in Base64 whenever it has to travel through something that only takes one clean line of text: a CI secret holding a seed script, an environment variable with an init query, a log line from a job runner, a JSON field in an API request. Paste the string below to read the SQL and save it as a .sql file.

Step 1

Paste the Base64 string

Paste the string into the input panel or upload a .txt or .base64 file that holds it. The Sample button loads a small CREATE TABLE script with two INSERTs.

•
From a secret or env var: copy the value as it is, line breaks and all. kubectl get secret … -o jsonpath output works directly.
•
From JSON or code: the surrounding quotes can stay, and URL-safe Base64 with - and _ is accepted too.
•
From a file: click Upload and pick a .txt or .base64 file that contains the string.
Step 2

Read the decoded SQL

A moment after you paste, the SQL appears in the output panel exactly as it was encoded. If the Base64 is broken, cut off or holds a file rather than text, you get a message saying what went wrong.

•
Nothing is rewritten: values like '00501' or 14.50, comments and blank lines come out exactly as encoded.
•
Broken Base64: a stray character is pointed out by line and column, and a string that was cut short while copying is called out as such.
•
Not SQL after all: if the bytes are an image, a PDF or an archive, you get a message instead of garbled text. Base64 to File can save those.
Step 3

Download the .sql file

Click Download to save the decoded text as decoded.sql, ready to open in your database client or run with psql, mysql or sqlcmd.

•
Same bytes as the original: the file is UTF-8, with the original line endings.
•
Tidy it up: paste the result into the SQL Formatter if the decoded query is all on one line.
•
Going the other way: SQL to Base64 encodes a script back into a single line.

What is Base64 to SQL Conversion?

Base64 turns any bytes into letters, digits, + and /. SQL is full of single quotes, semicolons, backslashes and line breaks, which tend to break YAML files, shell variables and JSON strings, so tools often store or send the script as Base64 instead. Decoding just reverses that: the bytes come back and are read as text again.

The page decodes the string into bytes, reads them as UTF-8 and shows the result without touching it. It does not check whether the SQL would run; a short note appears if the text has no SQL keywords at all.

Frequently Asked Questions

Where does Base64-encoded SQL usually come from?

Mostly from places that only take a single line of plain text. Deployment pipelines keep seed scripts and migration SQL in Base64 secrets or environment variables, Kubernetes ConfigMaps and Secrets hold init queries that way, ORMs and job runners sometimes log the query as Base64, and APIs put SQL into JSON fields as Base64 so quotes and line breaks cannot break the payload. Paste the string here to read what is inside.

Will my quoted values and numbers come back exactly?

Yes. The Base64 is turned back into its bytes and read as UTF-8 text, and nothing is reformatted after that. A string literal like '8901240544102066246', a zip code like '00501', a price written 14.50, Windows line endings and accented names such as 'José' all come out exactly as they were encoded. The .sql download is the same bytes, including a byte-order mark at the start if the original had one.

What kind of Base64 can I paste?

Plain Base64, Base64 split over many lines (as base64 on Linux or a MIME email writes it), URL-safe Base64 that uses - and _ with or without = padding, a data URI with ;base64, in it, and a value still wrapped in the quotes you copied it with from JSON or code. If a character does not belong in Base64, the error tells you its line and column.

It says the data is not SQL text. What does that mean?

The bytes decode fine but they are not readable text: a PNG, a PDF, a ZIP or gzip file, or a binary database backup. Those cannot be shown as SQL. If you want the file itself, Base64 to File saves the decoded bytes with the right extension. If the text decodes but has no SQL keywords in it, you still see it, with a short note that it may not be SQL.

Is Base64 a safe way to hide passwords in SQL scripts?

No. Base64 is an encoding, not encryption, and anyone who has the string can decode it in a second, exactly as this page does. If a seed script or connection setup holds real passwords or API keys, keep it in a proper secret store, not just in Base64.

Is the SQL I decode sent anywhere?

No. Decoding runs in JavaScript in your browser, and the .sql download is built on your own machine. Nothing is uploaded and nothing is kept, so a reload starts with an empty editor.

Related pages: SQL to Base64 · Base64 to File · SQL Formatter