How to Read a TCF Consent String: A Developer's Field Guide

What the TC String Actually Is

The IAB Transparency & Consent Framework produces a single compact token — the TC string — that travels with every ad request and tells vendors exactly what a user has and hasn’t agreed to. It is Base64-URL encoded and packed at the bit level, so it looks like gibberish (CPxy...AAA) but encodes a precise, auditable record.

The Segments

A full TC string is several dot-separated segments. The first is the core string; others are optional:

The bitfields are the heart of it: bit N set to 1 means consent for purpose N or vendor N. Purpose 1 is “store/access information on a device,” purpose 3 and 4 cover personalized ads, and so on.

Decoding One in Practice

You rarely decode bits by hand. Use the IAB-provided libraries or a public decoder:

In JavaScript the __tcfapi('getTCData', 2, cb) call returns the already-parsed object — tcData.purpose.consents and tcData.vendor.consents are maps of id → boolean. That is your ground truth at runtime.

The Errors That Kill Revenue

When personalized demand silently disappears, the TC string is usually why:

A Debugging Workflow

Reproduce the user’s consent, grab the live TC string from __tcfapi or the ad request, run it through a validator, and compare the decoded purposes/vendors against what your partners require. Nine times out of ten the gap is a single vendor bit or a missing purpose 1.

Where FlexyConsent Fits

FlexyConsent generates spec-valid TC strings with a registered CMP ID, keeps them fresh, exposes the decoded state for debugging, and reports which purposes and vendors are actually being granted across your traffic — so you can see, not guess, where consent (and revenue) is leaking.

Key Takeaways

← Blog Read All →