Skip to content

Free · No sign-up · Nothing is uploaded

Validate an e-invoice without uploading it: Facturae, UBL and CII

E-invoice (Facturae)

Drop your invoice (Facturae 3.2, 3.2.1 or 3.2.2, signed or not, UBL or CII) and we tell you whether the structure is complete, whether tax IDs and totals add up and whether it has a XAdES signature, who signed and with which certificate. It also reads **VERI*FACTU QR codes. Everything runs in your browser: the invoice is never uploaded**.

Your invoice never leaves your computer: it is read and checked in the browser. No request carries its content.

What it checks

What this validator checks (and what it does not)

  • Format and version: Facturae 3.2, 3.2.1 or 3.2.2 (from the namespace of its official XSD, matching SchemaVersion), UBL 2.1 or CII, the two syntaxes of the European standard EN 16931.
  • Structure: required elements, header codes and the decimals each version allows.
  • Seller and buyer tax IDs: the DNI/NIE check letter (official algorithm) and the control character of company NIFs (warning only: its algorithm is not officially published).
  • Totals: each line, taxable base, taxes, withholdings, invoice total, payable total and batch totals, using the formulas in the official XSD. For UBL and CII, the EN 16931 BR-CO rules.
  • Signature: whether it is XAdES and enveloped, the signer, the certificate issuer, whether it was valid at signing time and which policy it declares.
  • **VERI*FACTU QR:** whether the link is a Tax Agency (AEAT) verification link and what it contains.

It does not validate the full XSD, verify the signature cryptography or certificate revocation, or check DIR3 codes. Before submitting to a Spanish public body, run it through the official FACe validator, which accepts signed Facturae 3.2–3.2.2, UBL and CII (it does receive your file).

How it works

How a Facturae invoice is checked

Facturae is an XML file with three blocks: FileHeader (version, modality and batch totals), Parties (seller and buyer with their tax IDs) and Invoices (one or more invoices with taxes, totals and lines). The signature, if any, sits inside the same XML. The official XSD schemas define which elements are required and how each total is calculated.

  1. 101

    Each line

    TotalCost = Quantity × UnitPriceWithoutTax

    Then GrossAmount = TotalCost − discounts + charges.

  2. 202

    Gross total

    TotalGrossAmount = Σ GrossAmount

  3. 303

    Taxable base

    TotalGrossAmountBeforeTaxes = gross − general discounts + general surcharges

  4. 404

    Invoice total

    InvoiceTotal = base + TotalTaxOutputs − TotalTaxesWithheld

  5. 505

    Payable

    TotalOutstandingAmount = InvoiceTotal − (subsidies + payments on account)

  6. 606

    Executable

    TotalExecutableAmount = payable − withheld − payment in kind + reimbursable + financial expenses

    Payment in kind only exists from 3.2.2.

VersionNamespace (official XSD)Decimals in totals
3.2http://www.facturae.es/Facturae/2009/v3.2/FacturaeExactly 2
3.2.1http://www.facturae.es/Facturae/2014/v3.2.1/FacturaeUp to 8
3.2.2http://www.facturae.gob.es/formato/Versiones/Facturaev3_2_2.xmlUp to 8

Mandate

Mandatory B2B e-invoicing in Spain: dates and formats

Law 18/2022 requires businesses and self-employed people to invoice each other electronically. Its regulation is Royal Decree 238/2026 and the deadlines started with Order HAC/1028/2026. According to the Tax Agency calendar: 6 October 2027 for businesses with a turnover above 8 million euros the previous year, and 6 October 2028 for everyone else. Accepted syntaxes: EN 16931 in UBL or CII, Facturae and EDIFACT; UBL is the reference syntax of the Tax Agency's public solution.

European formats

UBL, CII and EN 16931

EN 16931 is the European e-invoicing standard, with two XML syntaxes: UBL 2.1 and UN/CEFACT CII 16B (Implementing Decision (EU) 2017/1870). We check the calculation rules BR-CO-10 (line total), BR-CO-13 (total without VAT), BR-CO-15 (total with VAT) and BR-CO-16 (amount due), as published in the Commission's validation artefacts.

Signature

The XAdES signature of a Facturae invoice

The Facturae signature policy v3.1 requires XAdES-EPES, enveloped in the XML, with SigningTime and SignaturePolicyIdentifier, and the certificate in KeyInfo. We read all of that, but we do not verify the cryptography or revocation: the FACe validator does.

VERI*FACTU

The VERI*FACTU QR code

Invoices from software adapted to Royal Decree 1007/2023 carry a QR code linking to the Tax Agency's verification service with the seller's tax ID (nif), invoice number (numserie), issue date (fecha, DD-MM-YYYY) and total (importe), per the AEAT specification. Drop a screenshot or paste the link: we tell you whether it really points to the Tax Agency and whether the data is well formed. The actual check happens when you open the link.

Code

Validate invoices from your own software

check-facturae.js · JavaScript
// Check that the totals of a Facturae 3.2.x invoice add up, in the
// browser with DOMParser (no libraries). Formulas: from the annotations of
// the official XSD at facturae.gob.es.
const VERSIONS = {
  "http://www.facturae.es/Facturae/2009/v3.2/Facturae": "3.2",
  "http://www.facturae.es/Facturae/2014/v3.2.1/Facturae": "3.2.1",
  "http://www.facturae.gob.es/formato/Versiones/Facturaev3_2_2.xml": "3.2.2",
};

function checkFacturae(xml) {
  const doc = new DOMParser().parseFromString(xml, "application/xml");
  if (doc.querySelector("parsererror")) return { error: "Malformed XML" };
  const root = doc.documentElement;
  const version = VERSIONS[root.namespaceURI];
  if (root.localName !== "Facturae" || !version) return { error: "Not Facturae 3.2.x" };

  const num = (parent, name) => Number(parent.getElementsByTagName(name)[0]?.textContent ?? 0);
  const same = (a, b) => Math.abs(a - b) < 0.005;

  const errors = [];
  for (const inv of root.getElementsByTagName("Invoice")) {
    const t = inv.getElementsByTagName("InvoiceTotals")[0];
    const base = num(t, "TotalGrossAmount") - num(t, "TotalGeneralDiscounts") + num(t, "TotalGeneralSurcharges");
    if (!same(base, num(t, "TotalGrossAmountBeforeTaxes"))) errors.push("Taxable base");
    const total = num(t, "TotalGrossAmountBeforeTaxes") + num(t, "TotalTaxOutputs") - num(t, "TotalTaxesWithheld");
    if (!same(total, num(t, "InvoiceTotal"))) errors.push("Invoice total");
  }
  return { version, errors };
}
validate_facturae.py · Python
# Validate a Facturae file against the official XSD and check the total.
# pip install lxml  ·  XSD: download it from facturae.gob.es (Facturaev3_2_2.xml).
# The XSD imports the XMLDSig schema (xmldsig-core-schema.xsd) by URL: offline,
# save it next to it and change the schemaLocation.
from decimal import Decimal
from lxml import etree

schema = etree.XMLSchema(etree.parse("Facturaev3_2_2.xml"))
invoice = etree.parse("invoice.xsig")  # signed or unsigned XML

if not schema.validate(invoice):
    for e in schema.error_log:
        print(f"Line {e.line}: {e.message}")

def amount(node, name):
    value = node.findtext(name)
    return Decimal(value) if value else Decimal("0")

for t in invoice.iter("InvoiceTotals"):
    expected = (amount(t, "TotalGrossAmountBeforeTaxes")
                + amount(t, "TotalTaxOutputs")
                - amount(t, "TotalTaxesWithheld"))
    if abs(expected - amount(t, "InvoiceTotal")) >= Decimal("0.005"):
        print("InvoiceTotal does not add up:", amount(t, "InvoiceTotal"), "≠", expected)

FAQ

E-invoice FAQ

Is my invoice uploaded anywhere?

No. The file is read and checked in your browser. No request carries the invoice content.

Are Facturae and FACe the same thing?

No. Facturae is the file format (a signed XML). FACe is the portal where invoices are submitted to the Spanish central government, in Facturae, UBL or CII.

Is e-invoicing the same as VERI*FACTU?

No. VERI*FACTU is a requirement for invoicing software (a record of every invoice and a QR code the Tax Agency can check). E-invoicing is the structured format of the invoice itself.

When does B2B e-invoicing become mandatory in Spain?

On 6 October 2027 for businesses above 8 million euros of turnover the previous year, and on 6 October 2028 for everyone else (Tax Agency calendar).

Does it verify the signature?

It reads the XAdES signature, signer, certificate and whether it was valid at signing time. It does not verify the cryptography or revocation: use the official FACe validator for that.

Does it work with UBL or CII?

Yes: it detects both EN 16931 syntaxes, reads seller, buyer and amounts, and checks BR-CO-10, 13, 15 and 16.

How do I open a .xsig file?

Drop it here to see seller, buyer, amounts and signature without uploading it. It is an XML file inside; any change breaks the signature.

About

About this validator

Built by Black Wings, a software studio in Valencia (Spain) working with small businesses. Our validators are free, single-purpose tools that show how we work.

  • XML parsing: fast-xml-parser (MIT); signing certificate with PKI.js; QR with jsQR (Apache-2.0). All in the browser.
  • Rules: the official Facturae 3.2, 3.2.1 and 3.2.2 XSDs and signature policy v3.1, Annex II of Order HAP/492/2014 and the EN 16931 BR-CO rules.
  • Tested with the official facturae.gob.es example (version 3.1, signed), the Commission's UBL and CII examples, and correct and deliberately broken Facturae 3.2.2 test invoices.
  • Not an official service and not linked to any public body.
  • Reviewed: 22 November 2026.

Privacy

What happens to your invoice

Nothing leaves your computer. The invoice (or QR image) is read and checked in your browser: we do not upload or store it, and no request carries its content. If you click «Verify with the AEAT», you leave this site and the Tax Agency receives the QR data. More in our privacy policy.

Other validators

More free validators

Need this inside your own software?

Validating IBANs and tax IDs when a customer signs up, checking whole lists or connecting invoicing to the bank: that is the kind of work we do at Black Wings.

Tell us about it