LEGO Catalog Database Downloads

Parts, sets, minifigs, colors and inventories. Simple CSV files, updated daily.

The catalog of official LEGO sets is available for bulk download below. Free for personal and commercial use, provided you acknowledge Rebrickable as your data source.

Download the complete catalog

All CSV files in one archive.

Last updated

How the files fit together

Open full-size diagram
Public CSV schema showing the LEGO data files and the identifiers used to join them.
Schema for the CSV files. Select the diagram to expand.

Working with the catalog

  • Official LEGO sets, parts and minifigs only. No B-models, sub-sets or MOCs.
  • Sets and minifigs have one or more inventories in inventories.csv.
  • Inventories can contain parts, sets and minifigs, listed in the three inventory_*.csv files.
  • inventories.set_num refers to either sets.set_num or minifigs.fig_num.

Reference codes

Part relationships
P Print · R Pair · B Sub-Part · M Mold · T Pattern · A Alternate

External systems
BS Brickset · BL BrickLink · BO BrickOwl · LE LEGO · LD LDraw

Individual CSV files - choose just the data you need
  • themes.csv
    GZIP ZIP
  • colors.csv
    GZIP ZIP
  • part_categories.csv
    GZIP ZIP
  • parts.csv
    GZIP ZIP
  • part_relationships.csv
    GZIP ZIP
  • elements.csv
    GZIP ZIP
  • sets.csv
    GZIP ZIP
  • minifigs.csv
    GZIP ZIP
  • inventories.csv
    GZIP ZIP
  • inventory_parts.csv
    GZIP ZIP
  • inventory_sets.csv
    GZIP ZIP
  • inventory_minifigs.csv
    GZIP ZIP
  • color_mappings.csv
    GZIP ZIP
  • part_mappings.csv
    GZIP ZIP
  • set_mappings.csv
    GZIP ZIP

LDraw images by color

ZIP archives

Part images generated from the LDraw system, ready for use in your projects. LEGO element images and photos are not available for bulk download.

DJDT

Time

Resource usage

Resource Value
User CPU time 48.984 msec
System CPU time 0.945 msec
Total CPU time 49.929 msec
Elapsed time 63.776 msec
Context switches 41 voluntary, 0 involuntary

Browser timing

Timing attribute Timeline Milliseconds since navigation start (+length)

SQL queries from 1 connection

  • default 4.09 ms (7 queries )
Query Timeline Time (ms) Action
SELECT "lego_color"."id",
       "lego_color"."name",
       "lego_color"."rgb",
       "lego_color"."is_trans",
       "lego_color"."fuzzy_color_id",
       "lego_color"."is_active"
  FROM
"lego_color"
 WHERE
"lego_color"."is_active"
 ORDER BY
"lego_color"."name" ASC
SELECT ••• FROM "lego_color" WHERE "lego_color"."is_active" ORDER BY "lego_color"."name" ASC
0.40

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(867)
  colors_dict = {c.id: c for c in Color.objects.all()}

SELECT "lego_part"."id",
       "lego_part"."part_num",
       "lego_part"."name",
       "lego_part"."part_cat_id",
       "lego_part"."notes",
       "lego_part"."is_active",
       "lego_part"."search_vector",
       "lego_part"."ldraw_part_id",
       "lego_part"."bricklink_part_id",
       "lego_part"."ignore_color_errors",
       "lego_part"."part_material_id",
       "lego_part"."is_bricklink_minifig",
       "lego_part"."is_bricklink_book",
       "lego_part"."is_bricklink_gear",
       "lego_part"."show_generic_part_msg",
       "lego_partcategory"."id",
       "lego_partcategory"."name",
       "lego_partcategory"."part_count",
       "lego_partcategory"."img",
       "lego_partcategory"."slug",
       "lego_partmaterial"."id",
       "lego_partmaterial"."name",
       "lego_partoverlay"."part_id",
       "lego_partoverlay"."length",
       "lego_partstats"."part_id",
       "lego_partstats"."num_sets",
       "lego_partstats"."num_mocs",
       "lego_partstats"."num_set_parts",
       "lego_partstats"."num_moc_parts",
       "lego_partstats"."y1",
       "lego_partstats"."y2",
       "lego_partstats"."is_dirty"
  FROM
"lego_part"
 INNER JOIN
"lego_partcategory"
    ON
("lego_part"."part_cat_id" = "lego_partcategory"."id")
 INNER JOIN
"lego_partmaterial"
    ON
("lego_part"."part_material_id" = "lego_partmaterial"."id")
  LEFT OUTER JOIN
"lego_partoverlay"
    ON
("lego_part"."id" = "lego_partoverlay"."part_id")
  LEFT OUTER JOIN
"lego_partstats"
    ON
("lego_part"."id" = "lego_partstats"."part_id")
 WHERE
("lego_part"."is_active" AND "lego_part"."part_num" = '3003')
 LIMIT
21
SELECT ••• FROM "lego_part" INNER JOIN "lego_partcategory" ON ("lego_part"."part_cat_id" = "lego_partcategory"."id") INNER JOIN "lego_partmaterial" ON ("lego_part"."part_material_id" = "lego_partmaterial"."id") LEFT OUTER JOIN "lego_partoverlay" ON ("lego_part"."id" = "lego_partoverlay"."part_id") LEFT OUTER JOIN "lego_partstats" ON ("lego_part"."id" = "lego_partstats"."part_id") WHERE ("lego_part"."is_active" AND "lego_part"."part_num" = '3003') LIMIT 21
1.06

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(882)
  part_3003 = Part.objects.get(part_num='3003')

SELECT "lego_element"."id",
       "lego_element"."part_id",
       "lego_element"."color_id",
       "lego_element"."element_id",
       "lego_element"."design_id",
       "lego_element"."descr",
       "lego_element"."color_descr",
       "lego_element"."last_download_attempt",
       "lego_element"."num_download_attempts",
       "lego_element"."is_export_id",
       "lego_element"."is_active"
  FROM
"lego_element"
 INNER JOIN
"lego_color"
    ON
("lego_element"."color_id" = "lego_color"."id")
 WHERE
("lego_element"."is_active" AND "lego_element"."part_id" IN (147))
 ORDER BY
"lego_color"."name" ASC, "lego_element"."element_id" ASC
SELECT ••• FROM "lego_element" INNER JOIN "lego_color" ON ("lego_element"."color_id" = "lego_color"."id") WHERE ("lego_element"."is_active" AND "lego_element"."part_id" IN (147)) ORDER BY "lego_color"."name" ASC, "lego_element"."element_id" ASC
0.77

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(882)
  part_3003 = Part.objects.get(part_num='3003')

SELECT "lego_partcolorstats"."id",
       "lego_partcolorstats"."part_id",
       "lego_partcolorstats"."color_id",
       "lego_partcolorstats"."num_sets",
       "lego_partcolorstats"."num_mocs",
       "lego_partcolorstats"."num_set_parts",
       "lego_partcolorstats"."num_moc_parts",
       "lego_partcolorstats"."y1",
       "lego_partcolorstats"."y2",
       "lego_partcolorstats"."is_dirty",
       "lego_partcolorstats"."ignore_color_errors"
  FROM
"lego_partcolorstats"
 WHERE
"lego_partcolorstats"."part_id" IN (147)
SELECT ••• FROM "lego_partcolorstats" WHERE "lego_partcolorstats"."part_id" IN (147)
0.61

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(882)
  part_3003 = Part.objects.get(part_num='3003')

SELECT "lego_partcost"."id",
       "lego_partcost"."part_id",
       "lego_partcost"."color_id",
       "lego_partcost"."is_used",
       "lego_partcost"."cost_avg",
       "lego_partcost"."cost_min",
       "lego_partcost"."cost_max",
       "lego_partcost"."cost_count"
  FROM
"lego_partcost"
 WHERE
"lego_partcost"."part_id" IN (147)
SELECT ••• FROM "lego_partcost" WHERE "lego_partcost"."part_id" IN (147)
0.57

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(882)
  part_3003 = Part.objects.get(part_num='3003')

SELECT "lego_partphoto"."id",
       "lego_partphoto"."part_id",
       "lego_partphoto"."color_id",
       "lego_partphoto"."submitted_by_id",
       "lego_partphoto"."image",
       "lego_partphoto"."timestamp",
       "lego_partphoto"."is_active",
       "lego_partphoto"."is_primary"
  FROM
"lego_partphoto"
 WHERE
("lego_partphoto"."is_active" AND "lego_partphoto"."part_id" IN (147))
SELECT ••• FROM "lego_partphoto" WHERE ("lego_partphoto"."is_active" AND "lego_partphoto"."part_id" IN (147))
0.54

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(882)
  part_3003 = Part.objects.get(part_num='3003')

SELECT "countries_plus_country"."iso",
       "countries_plus_country"."iso3",
       "countries_plus_country"."iso_numeric",
       "countries_plus_country"."fips",
       "countries_plus_country"."name",
       "countries_plus_country"."capital",
       "countries_plus_country"."area",
       "countries_plus_country"."population",
       "countries_plus_country"."continent",
       "countries_plus_country"."tld",
       "countries_plus_country"."currency_code",
       "countries_plus_country"."currency_symbol",
       "countries_plus_country"."currency_name",
       "countries_plus_country"."phone",
       "countries_plus_country"."postal_code_format",
       "countries_plus_country"."postal_code_regex",
       "countries_plus_country"."languages",
       "countries_plus_country"."geonameid",
       "countries_plus_country"."neighbours",
       "countries_plus_country"."equivalent_fips_code"
  FROM
"countries_plus_country"
 WHERE
"countries_plus_country"."iso" = 'US'
 LIMIT
21
SELECT ••• FROM "countries_plus_country" WHERE "countries_plus_country"."iso" = 'US' LIMIT 21
0.13

Connection: default

Transaction status: Idle

/home/nathan/rb/site/./lego/views/parts.py in download_files(884)
  return render(request, 'lego/downloads.html', {'downloads': downloads, 'images': images,

/home/nathan/rb/site/./rb/templatetags/rb_geo.py in geo_currency(20)
  geo_data = user.geo.get_user_currency()

/home/nathan/rb/site/./geo/geo.py in get_user_currency(253)
  country = Country.objects.get(iso=country_code)

74 </a>
75 </li>
76 <li>
77 {% geo_currency request.user %}
78 </li>
79 {% comment %}
80 <li class="hidden-xs hidden-sm">
81 <a href={% if request.user.is_authenticated %}"{% url 'user_profile_settings' request.user.get_username %}#personalisation"{% else %}"#" onclick="return false;"{% endif %} title="All date/times are being converted to this timezone">{% get_user_timezone request.user %}</a>

/home/nathan/rb/site/rb/templates/rb/includes/topbar.html

Log messages

No messages logged.