SOQL Formatter & Checker
Paste a SOQL query — get it formatted and checked for the mistakes that make queries slow or fail in production.
Runs in your browser — nothing you paste is sent to us or stored.
How to use it
- 1
Paste a query
Plain SOQL from the Developer Console or Workbench, or an inline Apex query in [ brackets ] — bind variables are fine.
- 2
Read the checks
Errors are things Salesforce will refuse; warnings and tips are about speed, limits and security.
- 3
Copy it back
Copy the formatted query into your code or a code review. Keywords are upper-cased; field names keep their case.
Questions
What makes a SOQL query “selective”?
A selective query filters on an indexed field (Id, Name, external IDs, lookups, CreatedDate, SystemModstamp and fields you asked Salesforce to index) with a condition that narrows the result enough for the index to be used. On large objects, non-selective queries in triggers can fail with “Non-selective query against large object type”.
Why are LIKE '%text' and != flagged?
A wildcard at the start of a LIKE pattern, and negative operators such as !=, NOT IN and NOT LIKE, can’t use an index — Salesforce has to scan every row. They’re fine on small objects; on big ones, combine them with a selective positive filter, or use SOSL for “contains” searches.
What does WITH USER_MODE do?
It runs the query with the running user’s object permissions, field-level security and sharing, instead of the system context Apex uses by default — so users can’t see data through your code that they couldn’t see in Salesforce. It’s the modern replacement for WITH SECURITY_ENFORCED.
Why shouldn’t I hard-code record IDs?
Record IDs are different in every sandbox and in production, so a query that works in one org returns nothing in another. Pass the ID in a bind variable (:recordId), or filter on a stable value such as a DeveloperName or an external ID.
Are there limits on LIMIT and OFFSET?
Apex can retrieve at most 50,000 rows per transaction across all queries, OFFSET can’t be more than 2,000, and FIELDS(ALL) or FIELDS(CUSTOM) need LIMIT 200 or lower. For bigger volumes use Batch Apex, or page with a WHERE on Id.
Is my query sent anywhere?
No. Formatting and checks happen in your browser; the tool doesn’t connect to any org.
Further reading
Want to go beyond the tools?
Learn Salesforce development — live classes with people who build on Salesforce every day.