TCF Consent String Encoder

Build an IAB TCF v2.2 Transparency & Consent (TC) string from CMP settings, purpose consents, special features and vendor ids — encoded in your browser.

The TCF Consent String Encoder runs entirely in your browser. Your CMP settings, purpose selections and vendor ids are encoded on your device, no Global Vendor List is fetched, and nothing is uploaded to ArrayKit.

Built and maintained by Udit Agarwal

Open the TCF Consent Decoder

About TCF Consent String Encoder

The TCF Consent String Encoder builds an IAB TCF v2.2 Transparency & Consent (TC) string from a form: set your CMP ID, CMP version, consent screen, consent language, vendor list version and TCF policy version, then toggle purpose consents (1-11), purpose legitimate interests, special feature opt-ins and a list of vendor consent ids. It assembles a valid TCModel and produces the base64url TC string you can paste into a CMP fixture, a Prebid config, an ad request, or a QA test. It is handy when ad-ops engineers and CMP developers need a deterministic string to reproduce a consent scenario or debug why a demand partner is being dropped. Every field is encoded on your device — no CMP API is called and no global vendor list is fetched from the network, so test consent data never leaves your browser.

Features

  • Set CMP ID, CMP version, consent screen and consent language from simple fields
  • Choose the vendor list version, TCF policy version and service-specific vs global scope
  • Toggle all 11 registered purposes for consent and for legitimate interest
  • Opt in to the two special features (precise geolocation, device scanning)
  • Encode a comma-separated list of vendor consent ids into the vendor section
  • Outputs a base64url TC string you can copy in one click
  • Deterministic encoding so the same selections always yield the same string
  • Runs entirely in your browser with no vendor list fetched from the network

How to use the TCF Consent String Encoder

  1. Enter your CMP ID, CMP version, consent screen and two-letter consent language
  2. Set the vendor list version, TCF policy version and the storage scope toggle
  3. Check the purposes, legitimate interests and special features the user opted into
  4. Type the vendor consent ids as a comma-separated list
  5. Copy the encoded TC string and drop it into your CMP, ad request or test fixture

Example

Input

cmpId: 300, cmpVersion: 1, lang: EN
purposeConsents: 1,2,3,4,7
vendorConsents: 1,8,755

Output

COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAAAA... (base64url TC string)

The selected purposes and vendor ids are packed into a TCF v2.2 core string.

Common errors & troubleshooting

  • A vendor id you added is missing when the string is decoded. — The TCF encoder validates vendor consents against a vendor list. This tool declares each id you enter so it survives — decode the output here or in the TCF Consent Decoder to confirm the vendor bit is set.
  • The decoded consent language is not what you typed. — TCF v2.2 forces the consent language to two-letter uppercase (EN, FR, DE). Enter exactly two letters; the tool uppercases them before encoding.
  • A downstream CMP rejects the string with a cmpId error. — CMP IDs of 0 and 1 are reserved and many decoders reject them. Use the real IAB-assigned CMP ID (an integer greater than 1).
  • The vendor list version in the decoded string differs from your input. — The encoded vendor list version and TCF policy version come from the values you enter in the metadata fields — set them to match the GVL your CMP is running.

Frequently asked questions

What is a TCF consent string encoder?
It is a tool that turns CMP settings and user consent choices — purposes, legitimate interests, special features and vendor ids — into an IAB TCF v2.2 Transparency & Consent (TC) string, the base64url value CMPs pass to vendors and ad requests.
Which TCF version does this encoder produce?
It builds TCF v2.2 core strings. You control the TCF policy version and vendor list version fields, and the output is a standard base64url TC string that TCF-aware CMPs and decoders can read.
How do I add vendor consents to the string?
Type the IAB vendor ids into the vendor consent field as a comma- or space-separated list (for example 1, 8, 755). Each id is encoded into the vendor-consent section of the TC string.
Why must the consent language be two letters?
The TCF spec stores the consent language as a two-character ISO-639-1 code. The encoder uppercases and validates your input, so enter codes like EN, FR or DE rather than full language names.
Does encoding fetch the Global Vendor List from a server?
No. To stay fully in your browser, the tool builds a minimal in-memory vendor list from the ids you enter instead of downloading the GVL. Your CMP settings and vendor ids are never sent anywhere.
Can I decode a string I built here?
Yes. Paste the encoded output into the TCF Consent Decoder to inspect the CMP fields, purposes and vendors and confirm the string round-trips as expected.

Related tools

More Programmatic Ads tools

  • ads.txt Validator — Validate ads.txt and app-ads.txt records against the IAB spec, line by line.
  • sellers.json Validator — Validate a sellers.json document against the IAB spec and flag every error.
  • SupplyChain (schain) Builder — Build and validate an OpenRTB SupplyChain object and its serialized schain string.
  • CPM Calculator — Calculate CPM, impressions or media cost from any two values, both ways.
  • eCPM Calculator — Calculate eCPM from ad earnings and impressions, or reverse-solve either input.
  • Fill Rate Calculator — Calculate ad fill rate from requests and impressions served, with unfilled counts.
  • IAB Ad Size Reference — Look up IAB standard ad unit sizes by name or dimensions, like 300x250 and 728x90.
  • Prebid Ad Unit Generator — Generate a Prebid.js ad unit config with media types, sizes and bidder params.
  • CTR Calculator — Calculate click-through rate, clicks or impressions from any two values.
  • ROAS Calculator — Calculate return on ad spend, revenue or ad cost, with break-even ROAS.
  • OpenRTB Bid Response Validator — Check a bid response for missing fields, bad prices and absent macros.
  • VAST Validator — Validate VAST 2.0-4.3 ad XML against IAB rules and see errors and warnings, in your browser.

See all Programmatic Ads tools (23) · All tools