How to switch from KLADR to FIAS and not break anything
Disclaimer:
If you do not understand what these sets of letters mean, that's okay. Below we will talk about the realities of working with addresses in Russia. If you are not interested, read about topographic puns .
The right addresses are needed by companies that love their customers. Familiar banks, insurance and online stores that now use the KLADR directory are asking us what to do next. Therefore, we got tired and wrote a step-by-step guide on the transition

Why address classifiers are needed
Companies need customer addresses in order to send letters, indicate in contracts and agreements. But it’s not enough just to send a letter: it is advisable to receive and read it. Therefore, the addresses must be correct and understandable.
What government agency are you most interested in for you to receive letters from him? Right! Tax. Therefore, the Federal Tax Service of Russia has been developing and supporting departmental all-Russian address classifiers for many years. And since there are no more complete directories, they began to be used everywhere.
At first there was a KLADR, and there were 6 levels in it:
Region → District → City → Town → Street → House with buildings and buildings
In 2012, a new classifier, FIAS, was put into operation. We wrote about the main differences three years ago in the article “FIAS or KLADR: choose a directory of addresses” . The Federal Tax Service approached the development of a new classifier more thoroughly and tried to take into account all the rakes of the KLADR minuses. From the interesting, they added the start and end dates of the recording, entered a fixed ID for each house (it is assumed that it will not change).
Both classifiers are still being updated, but maintaining compatibility is becoming more difficult. Last year, FIAS began to add new levels. For example, planning structures are all kinds of country partnerships and micro-districts, there are already more than 81,000 in the classifier. As a result, the Federal Tax Service made a logical decision to stop supporting KLADR and remove it at the end of 2017.
How addresses are stored in FIAS and KLADR
We have seen many ways to store addresses in the CLADR structure. Basically they come down to two options:
- KLADR code to the street + house part of the form “house 1 building 3 apartment 33 ”, since parts of houses in the classifier are stored as ranges
- The address in the form of text is one field or broken down by the structure of the KLADR.
Since there is no part of the houses in FIAS, we recommend storing the address as:
- FIAS code to the street + house + apartment to identify the address ( detailed recommendations ).
- Address in one line in FIAS format. It’s better to keep the original address. FIAS is still a tax guide, and there is more to it.
That is, the task of migration is to translate the code or text address in the format of KLADR into the FIAS code.
Classification codes look like this:
- CLADER : SS + RRR + YYY + PPP + UUUU + DDDD;
- FIAS : SS + RRR + YYY + PPP + SSSS + UUUU + DDDD (or ZZZZ) + OOOO.
It looks scary, consider an example: Leningrad region, Vsevolozhsk district, Kudrovo village, New Okkervil microdistrict. The address really exists, here it is on Yandex.Maps . At first glance, the classification code KLADR and FIAS looks the same for it: 470050000550023 . We decompose it into components.
| No. | Level | Example | FIAS code | code KLADR |
| 1 | Region | Leningrad region | SS : 47 | SS : 47 |
| 2 | Autonomous Okrug | |||
| 3 | Area | Vsevolozhsk district | PPP : 005 | PPP : 005 |
| 4 | Town | YYY : 000 | YYY : 000 | |
| 5 | Intracity Territory | |||
| 6 | Locality | Kudrovo village | ||
| 65 | Planning structure | md New Occerville | ||
| 7 | Street | UUUU | UUUU : 0023 | |
| 75 | Land plot | ZZZZ | ||
| 8 | Building, construction, construction in progress | DDDD | DDDD | |
| 9 | The room within the building, structure | OOOO | ||
| 90 | Additional territory | |||
| 91 | Subordinates of Additional Territories |
From the example it is clear that even in simple situations there is a misunderstanding between the classifiers. But there is another very important point.
The classification code reflects the current structure of the address, and it can change. For example, in Okkervil, the area will change and the entire code will become invalid, we will not find it anymore.
To get rid of this, the FIAS also added a FIAS identification code . This is a global identifier for each object: city, street, district, etc. It looks like a set of letters and numbers, which is formed according to the GUID (Globally Unique Identifier) standard. A typical GUID in FIAS looks like this: f77948dc-7bc8-42cb-979e-2c958d162d63 .
KLADR code → FIAS identification code
If your address is stored as the street KLADR code + house part (“house 1 building 3 apartment 44”), then for him everything is relatively simple.

The ADDROBJ table stores all address objects with their identifiers.
To work, you need the ADDROBJ table from FIAS unloading in xml or dbf format. It stores all the objects (cities, streets, etc.) in a row with unique GUIDs.
We will use the following columns:
- code KLADR (PlainCode);
- name and type of text (FormalName and ShortName);
- relevance of the object (CurrStatus);
- Postal Code (PostalCode)
- FIAS own and parent identifiers (AoGuid and ParentGuid);
- level (AoLevel).
Example: Moscow, St. Alexander Solzhenitsyn . CLADER code: 77000000000151900 .
Step 1. We extract the code from the KLADR code to the street, that is, we take the first 15 digits: 77000000000151900 .
- If KLADR is less than 15 digits, take 11 and add zeros - this is the code to the settlement: 770000000000000 ;
- Less than 11 digits - take 8: 77000000000000000 ;
- Less than 8 - take 5: 77000000000000000 ;
- Less than 5 - take 2 digits of the region code: 77000000000000000.
Step 2. We are looking for the code KLADR in the PlainCode field. If there is one record, then save the value of the AoGuid field and skip the next item. But according to our code 770000000001519 there are three entries, an additional check is needed.
Step 3. Find the current entry. The value of the CurrStatus = 0 field means that the record is relevant. Select it and save the value of the AoGuid field. FIAS identification code found!
- Alexander Solzhenitsyn, CurrStatus = 2;
- Communist B., CurrStatus = 1;
- Alexandra Solzhenitsyn, CurrStatus = 0, AuGuid = f77948dc-7bc8-42cb-979e-2c958d162d63.
As a bonus, we collect the text address for the found AoGuid:
- take PostalCode - it's a zip code: 109004
- add ShortName and FormalName: 109004, ul. Alexandra Solzhenitsyna
- if the object is a region (field AoLevel = 1), then the address is ready. But in our case, AoLevel = 7 is the street. Therefore, we look for the parent element in the ParentGuid field and repeat the previous paragraph;
- for Alexander Solzhenitsyn Street, the parent record immediately has the level of the region - this is Moscow. We save ShortName and FormalName and collect the address: 109004, Moscow, st. Alexandra Solzhenitsyna
But you can do even easier and use the ready-made service. DaData.ru is able to prompt addresses in specific regions, regions, cities and towns. He understands the names (“ Peterhof ”), the codes KLADR (“ 7800000800000 ”) and FIAS (“ 8f238984-812b-4bb1-850b-49749fb5c56d ”).
Lowercase address KLADR → FIAS code
The easiest option is to use DaData.ru . The service will do everything for you automatically. But you can have fun yourself.
Single line addresses
If your addresses are stored in one line, like this:
Moscow, Bolshaya Kommunisticheskaya Street, 3, then congratulations, this is the most interesting task. You need to write your address parser, which will divide the string in the KLADR format into parts, look for each of its components in FIAS taking into account typos, abbreviations, historical names and determine the FIAS code from them. It is easier to do this with a ready-made address parser. How to choose an algorithm for the address filter , we talked about earlier.
ADDRESSES
If your addresses are stored laid out according to KLADR, then the task is a little easier.
| Region Type | Region Name | Street type | Street name | House type | House number |
| g | Moscow | Street | Communist B. | house | 3 |
The FIAS code can be collected using the same ADDROBJ table. But in this case, you need to move through the levels from larger to smaller.
Step 1. We take the name of the region and look for it in the FormalName field of the ADDROBJ table.
FormalName = Moscow →
AoGuid = 0c5b2444-70a0-4932-980c-b4dc0d3f02b5
Step 2. We go down the levels and look for a FormalName with a fixed parent - found by AoGuid in the previous step. In our case, the levels “city” and “settlement” are empty, and the next non-empty level is street.
ParentGuid = 0c5b2444-70a0-4932-980c-b4dc0d3f02b5 ,
FormalName = Communist B. → AoGuid = f77948dc-7bc8-42cb-979e-2c958d162d63
Step 3. If you get to the street, you can find a house. To do this, in the HOUSE table we are looking for a house number with a fixed AoGuid street. FIAS is not full of houses, so do not be discouraged if the desired number is not found.
AoGuid = f77948dc-7bc8-42cb-979e-2c958d162d63 ,
house number 3 →
HouseGuid = bce8be1f-f2f7-4cce-836e-08daac0b931e
Underwater rocks
Can something go wrong? Of course. For example, the name can easily find several objects. "Moscow, Tverskaya" - is it about the square or about the street? Then you need to compare types, but not so simple.
| LEVEL | SCNAME | SOCRNAME | KOD_T_ST |
| 7 | tract | Tract | 727 |
| 7 | dumb | Dead end | 728 |
| 7 | st | Street | 729 |
| 7 | account | Plot | 730 |
| 7 | f / x | Farm | 789 |
| 7 | farm | Farm | 769 |
| 7 | x | Farm | 758 |
| 7 | w | Highway | 731 |
The KLADR type can be abbreviated and complete: "ul" - "Street", "x" - "Khutor". FIAS explicitly stores only the abbreviated type (in the ShortName field). You can convert a full type to an abbreviated type using the SOCRBASE table; it stores the correspondence between abbreviated and full types for each level.
§ § §
And finally, the good news for those who are too lazy to steam all of the above. In the near future, we plan to release FIAS in the format KLADR for those who do not have time to switch to the FIAS format before the end of the year. Follow the news :-)
PS Thank you for the invaluable help in creating this article to my HFLabs colleagues Mikhail Berezin , Elena Rastorguev and Anton Zhiyanov .