Back to Blog
E-Invoicing 16 min readPublished May 13, 2025· Updated May 20, 2025

Create an XRechnung – Step by Step (2025)

Step-by-step tutorial: how to create a valid XRechnung – from data preparation through XML creation to KOSIT validation and submission.

docutools.pro Editorial Team

docutools.pro Editorial Team

Editorial Team

Creating an XRechnung looks complicated at first glance – XML files, namespaces, business terms, validation rules. In reality the process can be broken down into clearly defined steps. This tutorial walks you through the creation of a complete, KOSIT-valid XRechnung step by step, whether you use a tool or build the XML manually.

Step 1: Gather the Required Data

Before opening any tool or software, gather all invoice data. An incomplete data basis is the most common cause of validation errors.

  • Your business data: Name, full address (street, postcode, city, country), VAT ID (DE + 9 digits) or tax number, contact name, telephone, email, IBAN, BIC.
  • Customer data: Name, full address, Leitweg-ID (mandatory for authorities), order or contract number if applicable.
  • Invoice details: Unique invoice number, invoice date, service date or period, payment deadline.
  • Line items: For each line: description, quantity, unit of measure (UN/ECE code, e.g. C62 = piece), unit price (net), tax rate.
  • VAT information: Tax category (S, E, AE, Z, etc.), tax rate (19%, 7%, 0%) or exemption reason.

Step 2: Obtain the Leitweg-ID (for B2G)

If you invoice a German government authority, the Leitweg-ID in field BT-10 is mandatory. Without it, every XRechnung fails with KOSIT error BR-DE-2. Find the Leitweg-ID in the contract, purchase order, or on the authority's website. You can also use the Leitweg-ID directory at leitweg-id.de.

Step 3: Choose the Right Creation Method

There are three paths to an XRechnung:

  • Option A – Accounting software: DATEV, SAP, Lexware, Sage, Sevdesk, and others generate XRechnung directly from your invoice draft. This is the simplest option for existing users of this software.
  • Option B – Web-based generator: Our XRechnung Generator creates compliant UBL XML files directly in the browser without registration. Ideal for sole traders and micro-businesses.
  • Option C – Manual / programmatic: For developers and businesses with special requirements: write the XML file directly or generate via API.

Step 4: Create the XRechnung Using Our Generator

  1. Open the XRechnung Generator at docutools.pro/tools/generator.
  2. Fill in the Seller section: company name, address, VAT ID or tax number, contact details, and IBAN.
  3. Fill in the Buyer section: name, address, and – for government customers – the Leitweg-ID in the Buyer Reference field.
  4. Enter invoice details: invoice number, date, service date, payment deadline.
  5. Add invoice line items: description, quantity, unit, unit price, tax rate.
  6. Choose the output format: UBL XML (standard) or CII XML.
  7. Click Generate – the XML file is created instantly in the browser and offered as a download. No data is sent to any server.

Step 5: Verify the Calculations

Before validating, manually verify the calculation logic against the key values:

  • Net amount per line = quantity × unit price (net).
  • BT-106 sum of line net amounts = sum of all line net amounts.
  • BT-116 taxable amount = BT-106 (minus document allowances, plus document charges).
  • BT-117 VAT amount = BT-116 × tax rate / 100 (rounded to 2 decimal places).
  • BT-112 invoice total incl. tax = BT-106 + BT-110.
  • BT-115 amount due = BT-112 (if no prepayments).

Step 6: Validate the XRechnung

Upload the generated XML file to our XRechnung Viewer at docutools.pro/tools/viewer. The Viewer runs all four validation layers: XML well-formedness, XSD schema, EN 16931 Schematron, and CIUS DE Schematron. Every error message includes the rule code (e.g. BR-DE-1), the affected XML path, and a correction hint.

Also validate your first XRechnung against the official KoSIT online validator (validator.kosit.de). This ensures your file passes the reference implementation before you submit it to a government portal.

Step 7: Fix Common Validation Errors

  • BR-DE-1 (VAT ID missing): Add your VAT ID in format DE123456789 to BT-31. For small businesses: tax category E + BT-120 referencing § 19 UStG.
  • BR-DE-2 (Leitweg-ID missing): Enter the authority's Leitweg-ID in BT-10.
  • BR-CO-10 (sum mismatch): Check that all line net amounts are correctly summed.
  • BR-CO-13 (VAT amount wrong): Calculate: VAT amount = taxable amount × tax rate / 100.
  • Date format: All date fields must be in YYYY-MM-DD format.

Step 8: Submit the XRechnung

After successful validation, submit the XRechnung:

  • Federal authorities: Submit via xrechnung.bund.de (ZRE) by web upload, email to rechnungseingang@bund.de, or De-Mail.
  • State authorities: Via the OZG-RE portal or the state-specific e-invoicing portal. Check the respective state's website.
  • B2B: Send the XML file by email (as attachment), via a supplier portal, or via Peppol.

Step 9: GoBD-Compliant Archiving

After sending, the XRechnung must be stored for 10 years in a revision-safe manner. Save the original XML file in a GoBD-compliant archive. Do not convert the file to another format – the original XML is the taxable document.

Tips for Recurring Invoices

  • Create a template: Save a validated invoice as a template and change only the invoice number, date, and variable items for each new invoice.
  • Maintain a numbering scheme: XRechnung invoice numbers must be unique. Use a consistent scheme, e.g. YYYY-NNN.
  • Update customer data: At each billing cycle, check whether the customer's Leitweg-ID or address has changed.
  • Always validate first: Every invoice, even from proven templates, should be validated before sending.
XRechnungTutorialSchritt für SchrittHow-toKOSITUBLErstellen