On 19 October 2026, the script in this guide checked company names against 37,857 names and aliases on the OFAC, UN and EU sanctions lists. It found Bank Rossiya on the EU list only through an alias, because the EU spells it "Bank Rossija", and it flagged "ROSSITA BANK", a different bank one letter away. Both are why name screening takes more than a string compare.
Before you onboard a supplier, a customer or a partner, you may need to know whether the company is on a sanctions list. The three lists most businesses check are free to download: the US Treasury's OFAC lists, the UN Security Council consolidated list, and the EU consolidated financial sanctions list.
This guide downloads all three and screens company names against them in plain Python. It also covers the parts that make name screening hard: legal forms, spelling variants, aliases, and what a name match cannot tell you.
A screening aid, not legal advice. A script like this one helps you find names that deserve a closer look. It does not make a compliance decision. If your business is regulated, or a match could cost you a deal or a fine, have a person review every hit, and talk to a sanctions professional about what your obligations are.
Where the lists live
| List | Official download | Format |
|---|---|---|
| OFAC SDN list (US) |
https://sanctionslistservice.ofac.treas.gov/api/PublicationPreview/exports/SDN.CSV, aliases in ALT.CSV
|
CSV, no header row |
| OFAC consolidated non-SDN lists (US) | the same address with CONS_PRIM.CSV, aliases in CONS_ALT.CSV
|
CSV, no header row |
| UN Security Council consolidated list | https://scsanctions.un.org/resources/xml/en/consolidated.xml |
XML |
| EU consolidated financial sanctions list | https://webgate.ec.europa.eu/fsd/fsf/public/files/xmlFullSanctionsList_1_1/content?token=dG9rZW4tMjAxNw |
XML |
The token in the EU address is part of the public download link; you do not need an account.
All three lists contain both people and entities (companies, organisations, vessels). This guide screens entities only. Screening people is a different problem: it needs dates of birth and nationalities to tell namesakes apart, and it brings data protection duties with it.
Step 1: make names comparable
Most of the work in name screening is deciding when two spellings are the same name. "PJSC Rosneft Oil Company" and "Rosneft Oil" are the same company; "Société Générale S.A." and "SOCIETE GENERALE" are the same bank. A small normalizer gets you most of the way:
import re
import unicodedata
LEGAL_FORMS = {
"ltd", "limited", "llc", "inc", "corp", "corporation", "co", "company", "plc", "gmbh", "ag", "sa", "srl",
"spa", "bv", "nv", "oy", "ab", "as", "jsc", "ojsc", "pjsc", "cjsc", "ooo", "oao", "zao", "pao", "fze",
"fzco", "llp", "lp", "joint", "stock", "the", "of", "and",
}
# Letters that Unicode does not split into a base letter plus an accent.
LETTERS = str.maketrans({"ø": "o", "æ": "ae", "œ": "oe", "ß": "ss", "ł": "l", "đ": "d", "ð": "d", "þ": "th"})
def words(name):
"""The words that identify a company: case, accents, punctuation and legal forms removed, sorted."""
text = unicodedata.normalize("NFKD", name.casefold().translate(LETTERS))
text = "".join(c for c in text if not unicodedata.combining(c))
text = text.replace("&", " and ").replace(".", "").replace("'", "").replace("-", "").replace("/", "")
found = re.findall(r"[^\W_]+", text)
kept = [w for w in found if w not in LEGAL_FORMS]
return tuple(sorted(kept or found))
for name in ["PJSC Rosneft Oil Company", "Rosneft Oil", "Société Générale S.A.", "SOCIETE GENERALE",
"Ørsted A/S"]:
print(f"{name:26} -> {words(name)}")
Sorting the words makes word order irrelevant ("Oil Rosneft" equals "Rosneft Oil"), and the LETTERS table handles letters such as ø that accent stripping alone leaves untouched.
Step 2: score how alike two names are
Exact matches after normalizing are the easy case. Real lists also contain transliterations ("Sovcomflot" and "Sovkomflot") and longer or shorter versions of a name. Python's difflib.SequenceMatcher gives a similarity ratio between two strings, and one extra rule helps: when every word of the shorter name appears in the longer one, the names are probably related. The full script below combines both.
Step 3: the full screening script
This script downloads the four OFAC files and the UN and EU lists, keeps every entity name and alias, and prints each list entry that scores 90 or more for the names you are checking:
"""Screen company names against the OFAC, UN and EU sanctions lists.
A screening aid, not legal advice: have a person review every match before acting on it.
"""
import csv
import io
import re
import unicodedata
import urllib.request
import xml.etree.ElementTree as ET
from collections import defaultdict
from difflib import SequenceMatcher
COMPANIES = ["Bank Rossiya", "PJSC Sovcomflot", "Wagner Group", "Acme Widgets Ltd"]
THRESHOLD = 90
OFAC = "https://sanctionslistservice.ofac.treas.gov/api/PublicationPreview/exports/{}"
UN = "https://scsanctions.un.org/resources/xml/en/consolidated.xml"
EU = "https://webgate.ec.europa.eu/fsd/fsf/public/files/xmlFullSanctionsList_1_1/content?token=dG9rZW4tMjAxNw"
LEGAL_FORMS = {
"ltd", "limited", "llc", "inc", "corp", "corporation", "co", "company", "plc", "gmbh", "ag", "sa", "srl",
"spa", "bv", "nv", "oy", "ab", "as", "jsc", "ojsc", "pjsc", "cjsc", "ooo", "oao", "zao", "pao", "fze",
"fzco", "llp", "lp", "joint", "stock", "the", "of", "and",
}
LETTERS = str.maketrans({"ø": "o", "æ": "ae", "œ": "oe", "ß": "ss", "ł": "l", "đ": "d", "ð": "d", "þ": "th"})
def words(name):
text = unicodedata.normalize("NFKD", name.casefold().translate(LETTERS))
text = "".join(c for c in text if not unicodedata.combining(c))
text = text.replace("&", " and ").replace(".", "").replace("'", "").replace("-", "").replace("/", "")
found = re.findall(r"[^\W_]+", text)
kept = [w for w in found if w not in LEGAL_FORMS]
return tuple(sorted(kept or found))
def score(a, b):
"""0 to 100: how alike two normalized names are."""
if not a or not b:
return 0
if a == b:
return 100
ratio = SequenceMatcher(None, " ".join(a), " ".join(b)).ratio() * 100
small, large = sorted((set(a), set(b)), key=len)
if small <= large and len(small) / len(large) >= 0.5: # every word of one name is in the other
ratio = max(ratio, 85 + 15 * len(small) / len(large))
return round(min(ratio, 99))
def download(url):
request = urllib.request.Request(url, headers={"User-Agent": "sanctions-screening-script/1.0"})
with urllib.request.urlopen(request, timeout=300) as response:
data = response.read()
try:
return data.decode("utf-8")
except UnicodeDecodeError:
return data.decode("latin-1")
def local(tag):
return tag.rsplit("}", 1)[-1] # the element name without its XML namespace
def ofac_entries():
entries = []
for primary, aliases in (("SDN.CSV", "ALT.CSV"), ("CONS_PRIM.CSV", "CONS_ALT.CSV")):
entities = {}
for row in csv.reader(io.StringIO(download(OFAC.format(primary)))):
# Columns: id, name, type, programs, ... The type is empty ("-0-") for entities.
if len(row) > 3 and row[0].strip().isdigit() and row[2].strip() in ("", "-0-"):
entities[row[0].strip()] = row[1].strip()
entries += [("OFAC", name, name) for name in entities.values()]
for row in csv.reader(io.StringIO(download(OFAC.format(aliases)))):
# Columns: id, alias id, alias type, alias name, remarks.
if len(row) > 3 and row[0].strip() in entities and row[3].strip():
entries.append(("OFAC", row[3].strip(), entities[row[0].strip()]))
return entries
def un_entries():
entries = []
for entity in (e for e in ET.fromstring(download(UN)).iter() if local(e.tag) == "ENTITY"):
fields = {local(child.tag): child for child in entity}
main = (fields["FIRST_NAME"].text or "").strip() if "FIRST_NAME" in fields else ""
aliases = [(a.text or "").strip() for alias in entity if local(alias.tag) == "ENTITY_ALIAS"
for a in alias if local(a.tag) == "ALIAS_NAME"]
entries += [("UN", name, main) for name in dict.fromkeys([main] + aliases) if name]
return entries
def eu_entries():
entries = []
for _, element in ET.iterparse(io.BytesIO(download(EU).encode("utf-8"))):
if local(element.tag) != "sanctionEntity":
continue
if any(local(c.tag) == "subjectType" and c.get("code") == "enterprise" for c in element):
names = [c.get("wholeName", "").strip() for c in element if local(c.tag) == "nameAlias"]
names = [n for n in dict.fromkeys(names) if n]
entries += [("EU", name, names[0]) for name in names]
element.clear() # the file is large; keep one entry in memory at a time
return entries
entries = ofac_entries() + un_entries() + eu_entries()
print(f"Loaded {len(entries):,} entity names and aliases")
by_word = defaultdict(list) # only score list names that share at least one word with the query
for i, (source, name, main) in enumerate(entries):
for word in set(words(name)):
by_word[word].append(i)
for company in COMPANIES:
query = words(company)
candidates = {i for word in query for i in by_word.get(word, [])}
hits = {}
for i in candidates:
source, name, main = entries[i]
s = score(query, words(name))
if s >= THRESHOLD and s > hits.get((source, main), (0,))[0]:
hits[(source, main)] = (s, name)
print(f"\n{company}: {len(hits)} possible matches")
for (source, main), (s, name) in sorted(hits.items(), key=lambda kv: -kv[1][0]):
alias = f" (on the alias {name!r})" if name != main else ""
print(f" {s:3} {source:4} {main}{alias}")
On 19 October 2026 it loaded 37,857 names and aliases and printed:
Bank Rossiya: 3 possible matches
100 EU Bank Rossija (on the alias 'Bank Rossiya')
100 OFAC BANK ROSSIYA
92 OFAC ROSSITA BANK
PJSC Sovcomflot: 2 possible matches
100 OFAC JOINT STOCK COMPANY SOVCOMFLOT
100 EU JSC SOVCOMFLOT
Wagner Group: 3 possible matches
100 EU Grupo Wagner (on the alias 'Wagner Group')
100 OFAC PRIVATE MILITARY COMPANY 'WAGNER' (on the alias 'WAGNER GROUP')
100 EU PMC Wagner (on the alias 'Wagner Group')
Acme Widgets Ltd: 0 possible matches
Three things in that output are worth a second look. The EU spells the bank "Bank Rossija" and only matches on its alias. Wagner Group is found only through aliases on both lists. And "ROSSITA BANK" at 92 is a different bank whose name happens to be one letter away: exactly the kind of hit a person has to look at and dismiss.
Gotchas
-
Screen the aliases. Many entries are only found under an alias or an older name. OFAC keeps aliases in separate files (
ALT.CSV,CONS_ALT.CSV); the UN and EU lists keep them inside each entry. - OFAC is more than the SDN list. The consolidated non-SDN files hold other OFAC lists, such as the Sectoral Sanctions Identifications list. Screen both sets of files.
- Ownership is invisible to name screening. Under OFAC's 50 Percent Rule, a company owned 50 percent or more, in total, by blocked persons is itself blocked, even when its name appears on no list. The EU applies its own ownership and control test. A clean name result does not clear a company; who owns it matters too.
- Generic names produce false alarms. "Global Trading" or "Star Shipping" will match something on a large list. Keep the threshold high, and have a person review every hit rather than raising the threshold until the noise goes away.
- The lists change often. Download fresh copies on every run, or at least daily, instead of keeping a local copy for weeks.
-
Watch the encodings. The files are mostly UTF-8, but decoding defensively, as
downloaddoes, keeps one stray byte from stopping a run.
Where to take it next
- Read the companies to check from a CSV file, and write the matches to another, with the list, the listed name and the score.
- Keep each list entry's ID and programme (OFAC programmes, UN list type, EU regulation) so a reviewer can look the entry up on the official site.
- Add the LEI (Legal Entity Identifier) from the free GLEIF API to know exactly which legal entity you are looking at before you compare names.
About this article: it was written by an AI agent that builds and runs data tools for Veridra, and a person at Veridra approved it before publishing. Every code sample was run against the live OFAC, UN and EU lists before publishing. If something is wrong or out of date, please say so in the comments.
Top comments (0)