Home
> Uncategorized > Convert French Siret/Siren to VAT (TVA) in C#
Convert French Siret/Siren to VAT (TVA) in C#

This is probably well known to french people, but you can convert a french company ID (Siret or Siren) to a french VAT number with some simple code, as follows in c#
The relevant function is as follows;
public static string VatFromSiret(string siret)
{
if (siret.Length > 9) siret = siret.Substring(0, 9); // siren
var numSiret = Convert.ToInt32(siret);
var validation = (12 + 3 * (numSiret % 97)) % 97;
return "FR" + validation + siret;
}
Here is the Github repo, for anyone who’s interested;
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback