Ampersand documentation

Ampersand executes AMPscript entirely in your browser and shows the rendered email instantly - no Salesforce Marketing Cloud account, no server, no publish cycle. Templates, subscriber data, and data extensions never leave your machine.

Quick start

Supported syntax

Function reference (83 functions)

String

Concat(str1, str2, ...)Null arguments become empty strings
Length(str)
Lowercase(str)
Uppercase(str)
ProperCase(str)Capitalizes the first letter of each word
Trim(str)
Replace(str, find, replaceWith)Case-sensitive
ReplaceList(str, replaceWith, find1, [find2, ...])
IndexOf(str, search)1-based; returns 0 when not found; case-insensitive
Char(charCode, [repeatCount])
Substring(str, start, [length])1-based start
RegExMatch(str, pattern, group, [options...])Group by number or name; supports IgnoreCase / Multiline options
BuildRowsetFromString(str, delimiter)Access parts with Row() + Field(row, 1)
StringToDate(str)
StringToHex(str)UTF-8 bytes as hex

Math

Add(a, b)
Subtract(a, b)
Multiply(a, b)
Divide(a, b)Division by zero is a render error
Mod(a, b)
Random(min, max)Integer, inclusive

Date & time

Now()Your local machine time
GetSendTime()Same as Now() locally
DateParse(str, [utc])
DateAdd(date, amount, unit)Units: Y, M, D, H, MI
DateDiff(start, end, unit)Units: Y, M, D, H, MI
DatePart(date, part)year, month, monthName, day, hour, minute; month and day are zero-padded like SFMC
Format(value, pattern, [type], [culture]).NET-style date and number patterns (yyyy, MMMM, N2, C2, ...)
FormatDate(date, datePattern, [timePattern], [culture])
FormatNumber(number, pattern, [culture])N/C/P/F patterns and #,##0.00-style masks; en-US output
LocalDateToSystemDate(date)Approximation: SFMC system time modeled as CST (UTC-6, no DST)
SystemDateToLocalDate(date)Same approximation as above

Utility

V(value)
IIF(condition, ifTrue, ifFalse)Both branches are evaluated
Empty(value)True for null or empty string
IsNull(value)
IsNullDefault(value, default)
AttributeValue(name)Reads from the Subscriber Data tab; null when missing
Output(value)Writes into the output stream from inside a code block
OutputLine(value)Output() plus a newline
RaiseError(message, [skipSend])Stops the whole render, like it stops a send
UrlEncode(str, [spacesAsPlus], [encodeAll])
RedirectTo(url)Returns the URL (no link-tracking wrap locally)
GUID()
WrapLongURL(url)Identity locally
IsEmailAddress(str)
IsPhoneNumber(str)North American 10/11-digit check

Data extensions

Data extensions come from the Data Extensions tab (one CSV per "=== Name ===" section; first row is the header). Writes mutate the in-memory copy for the current render only - every render starts fresh from your CSV, so previews stay deterministic.

Lookup(de, returnCol, col, value, [col2, value2, ...])First match; null when no match (IsNull is True), matching SFMC
LookupRows(de, col, value, ...)Case-insensitive match
LookupRowsCS(de, col, value, ...)Case-sensitive match
LookupOrderedRows(de, count, "field asc|desc", col, value, ...)count <= 0 returns all matches
LookupOrderedRowsCS(de, count, "field asc|desc", col, value, ...)
DataExtensionRowCount(de)
RowCount(rowset)
Row(rowset, index)1-based
Field(row, nameOrOrdinal, [raiseError])Ordinal is 1-based
InsertDE(de, col, value, ...)
InsertData(de, col, value, ...)Returns rows affected
UpdateDE(de, numKeys, keyCol, keyVal, ..., col, value, ...)
UpdateData(de, numKeys, keyCol, keyVal, ..., col, value, ...)Returns rows affected
UpsertDE(de, numKeys, keyCol, keyVal, ..., col, value, ...)
UpsertData(de, numKeys, keyCol, keyVal, ..., col, value, ...)Returns rows affected
DeleteDE(de, numKeys, keyCol, keyVal, ...)
DeleteData(de, numKeys, keyCol, keyVal, ...)Returns rows deleted

Content

Content blocks come from the Content Blocks tab (one block per "=== Name ===" section, matched by name, key, or id). AMPscript inside included content executes, just like in SFMC.

ContentBlockByName(name, [region], [raiseError], [default])
ContentBlockByKey(key, [region], [raiseError], [default])
ContentBlockById(id, [region], [raiseError], [default])
ContentArea(id, [region], [raiseError], [default])
ContentAreaByName(name, [region], [raiseError], [default])
TreatAsContent(str)Executes the string as AMPscript content
BeginImpressionRegion([name])No-op locally
EndImpressionRegion()No-op locally
ContentImageById(id, [defaultUrl])Resolves from Content Blocks; falls back to a placeholder image
ContentImageByKey(key, [defaultUrl])Same fallback behavior
TransformXML(xml, xslt)Uses the browser XSLT engine; browser preview only

Encryption & encoding

MD5(str, [charset])Lowercase hex
SHA1(str, [charset])
SHA256(str, [charset])
SHA512(str, [charset])
Base64Encode(str, [charset])UTF-8
Base64Decode(str, [charset])
EncryptSymmetric(value, cipher, pwdKeyName, password, [saltKeyName, salt, ivKeyName, iv])AES-CBC; round-trips locally, but ciphertext will not byte-match SFMC (different key derivation)
DecryptSymmetric(value, cipher, pwdKeyName, password, [saltKeyName, salt, ivKeyName, iv])

Not supported: platform-only functions

These require a live Marketing Cloud org and can never run locally. Calling one produces a clear error naming its category.

Marketing Cloud APIAddobjectarrayitem, Createobject, Invokecreate, Invokedelete, Invokeexecute, Invokeperform, Invokeretrieve, Invokeupdate, Setobjectproperty, Executefilter, Executefilterorderedrows
Sales & Service CloudCreatesalesforceobject, Updatesinglesalesforceobject, Retrievesalesforceobjects, Retrievesalesforcejobsources, Longsfid
HTTP (mock support planned)Httpget, Httppost, Httppost2, Httprequestheader, Ischtmlbrowser
CloudPages / Microsites (mock support planned)Cloudpagesurl, Micrositeurl, Livecontentmicrositeurl, Queryparameter, Requestparameter, Redirect
Contact ModelUpsertcontact
EinsteinEinsteinemailrecommendations
MobileConnect (SMS)Createsmsconversation, Endsmsconversation, Setsmsconversationnextkeyword
SocialGetsocialpublishurl, Getsocialpublishurlbyname, Getpublishedsocialcontent
Microsoft Dynamics CRMCreatemscrmrecord, Describemscrmentities, Describemscrmentityattributes, Retrievemscrmrecords, Retrievemscrmrecordsfetchxml, Setstatemscrmrecord, Updatemscrmrecords, Upsertmscrmrecord
Key ManagementGetjwt, Getjwtbykeyname
Content (platform assets)Barcodeurl, Image, Getportfolioitem, Attachfile

Limitations and approximations

Open the app - free, no signup, nothing leaves your browser.