SuiteQL formatter — format, indent and minify queries
Format SuiteQL and SQL in your browser: keyword casing, clause line breaks, indented joins and subqueries, plus a one-line minify mode.
Free · no signup · runs in your browser·Updated
Short answer
A SuiteQL formatter rewrites a query's whitespace and keyword casing without changing what it does: each major clause starts a new line, joins and their ON conditions are indented, and long select lists break one column per line. String literals and comments are copied through untouched. Minify mode collapses the same query back to a single line.
Queries arrive as one long line. Somebody pasted them out of a script parameter, a Slack message or a JSON body, and now you have to work out which condition belongs to which join. This SuiteQL formatter puts the structure back: clause per line, joins indented under their table, ON conditions indented again, and one column per line once the select list stops fitting.
It is a text tool, so it runs entirely in your browser. Nothing is uploaded, nothing is logged, and you can paste a query that mentions real customer names without thinking about it.
The one rule it never breaks: quoted strings and comments are opaque. A keyword inside 'CustInvc' stays lower case, and a -- comment keeps its own line, so the query you paste and the query you copy return the same rows.
Nothing leaves your browser — the query is tokenised and laid out locally. String literals and comments are copied through untouched.
Mode
Keyword case
Applies to clause items, join conditions and nested subqueries.
Comma position
Formatted query
SELECT
t.tranid,
t.trandate,
c.entityid AS customer,
SUM(tl.foreignamount) AS amount
FROM transaction t
INNER JOIN transactionline tl
ON tl.transaction = t.id
AND tl.mainline = 'F'
LEFT JOIN customer c
ON c.id = t.entity
WHERE
t.type = 'CustInvc'
AND t.trandate >= TO_DATE('2026-01-01', 'YYYY-MM-DD') -- posted invoices only
GROUP BY
t.tranid,
t.trandate,
c.entityid
HAVING SUM(tl.foreignamount) > 1000
ORDER BY 4 DESC
Lines in / out5 → 20
Keywords recognised22
Tokens70
Characters in / out417 → 452
Parentheses3 balanced
Formatting only — casing and whitespace changed, tokens untouched, so the query returns exactly what it returned before. This does not check that your tables, columns or joins are valid in your account.
Everything is computed in your browser. Nothing you type is sent anywhere or stored.
What the SuiteQL formatter changes, and what it leaves alone
Element
What happens
Why
Major clauses
SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, UNION each start a line
The shape of the query becomes readable at a glance
Joins
One line per join at the FROM indent, ON conditions indented under it
Lets you see which condition belongs to which table
AND / OR
New line inside WHERE, HAVING and ON — except inside BETWEEN
Filters become a checkable list instead of a paragraph
Select lists
One column per line once there are three columns or the list runs long
Short lists stay on the clause line; long ones stop wrapping mid-expression
Subqueries
Opening bracket ends the line, the inner query indents one level, the closing bracket lines up
Nesting depth is visible without counting brackets
Keywords
Upper, lower or left exactly as typed
Team convention, not a rule
Identifiers
Case preserved — transactionline stays transactionline
Your naming, including custom record and field names
Strings and comments
Copied through byte for byte
Casing a keyword inside a literal would change the result
Formatting rules applied by the tool.
SuiteQL is not quite the SQL you know
SuiteQL is NetSuite's query language: broadly SQL-92 with Oracle-style functions, run against analytics tables and views rather than the record model you see in the UI. You run it from the N/query module in SuiteScript, from the REST query endpoint, or from a query tool inside the browser.
It is read-only. SELECT only — there is no UPDATE or DELETE to get wrong, which is why a formatter is a safe thing to paste into.
Date handling is Oracle-flavoured.TO_DATE('2026-01-01', 'YYYY-MM-DD'), TRUNC, ADD_MONTHS — not the date functions you would use in SQL Server or Postgres.
Table names are not record names. Transactions live in transaction and transactionline; custom records are customrecord_* tables with their own field columns.
Results come back paginated. A query that looks instant in a formatter can still be several round trips against a real account.
Comma-leading lists, and why anyone would want them
The comma toggle switches between column, at the end of a line and , column at the start of the next. Leading commas look odd for about a week, then you stop shipping the classic error: commenting out the last column in a select list and leaving a trailing comma behind. With leading commas the comma travels with the column it belongs to.
Where a formatter stops helping
This tool reads punctuation, not your account. It cannot tell you that transactionline.foreignamount exists but transactionline.amount_foreign does not, that a join needs mainline = 'F' to avoid double counting, or that the column you are grouping by is the one your controller means. It reports unbalanced brackets and unterminated quotes, and that is the limit of its opinion.
That gap is the whole reason ERPray exists. You ask for the number in a sentence, and the answer arrives with the SuiteQL underneath it — derived from a dictionary of your own tables, fields and custom records, so the query references columns that are actually there. Format it here, read it there, and check the definition rather than trusting it.
Working with exported data instead of live queries? The CSV to JSON converter and JSON to CSV converter handle the round trip between a saved-search export and an API payload.
Frequently asked questions
What is a SuiteQL formatter?
A tool that re-lays out a SuiteQL or SQL query for readability: clause keywords on their own lines, joins and ON conditions indented, long select lists broken one column per line, and keywords cased consistently. It only changes whitespace and casing, so the formatted query returns exactly the same rows as the original.
Does formatting a SuiteQL query change its results?
No. SQL ignores whitespace between tokens, and keyword casing is not significant, so a formatted query is the same query. The one place it could matter is inside quoted strings and comments — this formatter treats both as opaque tokens and copies them through unchanged, so a value like 'CustInvc' is never re-cased.
Should SQL keywords be uppercase?
It is a convention, not a requirement. Upper-case keywords make the structure of a long query scannable because keywords and identifiers look different at a glance. Some teams prefer lower case throughout. Pick one and apply it consistently; the formatter has upper, lower and keep-as-typed so it can match whatever your repository already does.
How do I minify a SuiteQL query?
Switch the mode to Minify. The query collapses to a single line with single spaces between tokens and all comments removed. Removing comments is the important part: a double-dash comment on one line would otherwise comment out the rest of the query. Minified queries are what you want inside a JSON request body or a script parameter.
Why does NetSuite still reject my formatted query?
Because formatting is cosmetic. If the query was invalid before, it is invalid after — a missing bracket, a column that does not exist on that table, a join without a condition, or a function NetSuite does not support. The tool flags unbalanced brackets and unterminated quotes, but it cannot check your query against your account's schema.
Is SuiteQL the same as SQL?
Close, not identical. SuiteQL is broadly SQL-92 with Oracle-style functions such as TO_DATE, TRUNC and NVL, and it queries NetSuite's analytics tables and views rather than the records you see in the UI. It is read-only — SELECT statements only. Standard SQL keywords and joins work the way you expect.
This calculator needs you to find the inputs first. ERPray pulls them from your own ERP account and computes the answer live — with the exact query shown so you can check it.