What Is XRechnung? A Complete Guide
Everything businesses need to know about Germany's mandatory B2G e-invoicing format.
If you invoice German government agencies — at federal, state, or municipal level — you are legally required to use XRechnung. But even if you only deal with private businesses today, the 2027 B2B mandate makes understanding this format essential. Here is everything you need to know.
What is XRechnung?
XRechnung is Germany's national e-invoicing standard for business-to-government (B2G) invoices. It is a pure XML format based on UBL 2.1 (Universal Business Language) and complies with the European standard EN 16931.
Unlike a PDF invoice, an XRechnung file is not meant to be read by humans. It is a structured data file that government procurement systems can parse, validate, and process automatically. This is by design — it eliminates manual data entry, reduces errors, and speeds up payment cycles.
| Format | UBL 2.1 XML |
| Standard | EN 16931 (CIUS-XR) |
| Current version | 3.0.2 |
| File type | .xml |
| Maintained by | KoSIT (Koordinierungsstelle für IT-Standards) |
Who needs to use XRechnung?
XRechnung is mandatory for:
- Any business invoicing German federal government agencies (since November 2020)
- Suppliers to most German state (Länder) governments (timelines vary by state)
- Subcontractors on public procurement projects where the prime contractor requires it
- Cross-border suppliers billing German public sector clients (the requirement applies regardless of where your company is based)
Starting January 2027, the B2B e-invoicing mandate will require all larger businesses to send structured e-invoices (XRechnung or ZUGFeRD) for domestic B2B transactions as well.
How XRechnung works
An XRechnung invoice is a structured XML document that follows a strict schema. Every field has a defined name, format, and validation rule. Here are the key data elements:
Required fields
- Invoice number (unique identifier)
- Invoice date and due date
- Seller information (name, address, VAT ID)
- Buyer information (name, address, Leitweg-ID for government)
- Line items with description, quantity, unit price, and VAT rate
- Total amounts (net, VAT, gross) with currency code (EUR)
- Payment terms and bank details
The Leitweg-ID
For B2G invoices, the most important field is the Leitweg-ID — a routing number that identifies the specific government department or cost center receiving the invoice. Your government client must provide this number. Without it, your invoice will be rejected by the receiving system. The format is typically a series of numbers and hyphens, like 991-12345-67.
Validation and compliance
XRechnung invoices are validated at three levels:
- Schema validation — the XML structure must conform to the UBL 2.1 schema
- Schematron rules — business rules specific to XRechnung (the CIUS-XR rules) are checked
- EN 16931 compliance — the invoice must satisfy all rules of the European standard
If any validation fails, the invoice is rejected. This is strict by design — it ensures every invoice in the system is machine-processable and legally complete. NormaForm handles all three validation layers automatically.
XRechnung vs. ZUGFeRD — which to use?
Both formats are EN 16931-compliant, but they serve different purposes:
| Feature | XRechnung | ZUGFeRD |
|---|---|---|
| Output format | XML only | PDF with embedded XML |
| Human-readable? | No (XML only) | Yes (PDF + XML) |
| Primary use case | B2G (government) | B2B (business) |
If your client is a government agency, use XRechnung. If your client is a private business, ZUGFeRD is usually the better choice because it includes a human-readable PDF alongside the structured data. Read our ZUGFeRD guide.
Getting started with XRechnung
To create your first XRechnung invoice:
- Gather your business details (company name, address, VAT ID) and your client's information (including the Leitweg-ID for government clients)
- Enter the invoice data — line items, amounts, VAT rates, payment terms
- Choose XRechnung 3.0 as the output format
- Download the validated .xml file and submit it through your client's procurement portal (e.g., ZRE for federal, OZG-RE for state agencies)
Invoicing German government from abroad? Read our guide for Spanish freelancers creating XRechnung invoices.