CBDF Specification: Overview

Version 1.0 (Phase II)

Document: 00-Overview • Date: 2026-03-25

1. What is CBDF?

CBDF (Compact Binary Document Format) is a binary replacement for HTML/CSS designed to radically reduce the size of marked-up documents. A CBDF-formatted message can be as little as 1% of the size of an equivalent modern HTML email.

CBDF achieves this by:

  • Using 1 byte for page layout (256 predefined templates vs. hundreds of bytes of CSS/HTML)
  • Limiting colors to 65,536 (2 bytes vs. 7 bytes for CSS #RRGGBB)
  • Using a fixed font table of 4,096+ fonts (2 bytes vs. font-family strings)
  • Encoding all formatting as compact binary style records referenced by 1-byte indices
  • Using ASCII control characters (0x00-0x1F) as inline commands instead of verbose HTML tags
  • Placing binary resources (images) in a separate skippable section

2. Use Cases

  • QMail: Quantum-safe email (.qmail files)
  • QWeb: Web pages (.qweb files)
  • RAIDA: Client-server data exchange
  • Text messaging: Ultra-compact meta-only messages (14 bytes for "Hello")

3. Document Structure

[Meta] FS [Styles] FS [Text] FS [Resources] FS [Logic]
SectionDescription
MetaDocument envelope (subject, from, to, etc.). Never compressed.
StylesVisual formatting lookup tables. Compressed with Text.
TextMarked-up body content (UTF-8 + control codes). Compressed.
ResourcesBinary blobs (images, fonts). Never compressed. Skippable.
LogicExecutable code (Phase III, not yet implemented).

4. Specification Documents

DocumentDescription
00-OverviewThis document
01-Document-StructureSection layout, meta keys, compression, EOF
02-Meta-SectionMeta section: KV format, key table, mailbox format
03-Styles-SectionStyle sub-tables, record formats, bit layouts
04-Text-SectionControl codes in text, worked examples
05-Resources-SectionBinary resource format, abortable downloads
06-Logic-Section(Phase III, placeholder)
07-Control-CharactersThe 32 ASCII control character assignments
08-Color-SystemR5G6B5 encoding, transparency codes
09-Font-SystemFont IDs, effects, custom fonts

5. Phases

PhaseDescriptionStatus
Phase IPlain text only (qmail_cbdf.c)Implemented
Phase IIStyled text, images, nav bars, tables, layersCurrent phase
Phase IIILogic section (BEAM/Elixir), forms, interactive featuresPlanned