How to Program a Tesla Model S Key from Scratch Using LOKI Tool

Step-by-step guide to programming a Tesla Model S key fob with the LOKI diagnostic tool. Includes prerequisites, troubleshooting, and FAQs for DIY owners.

Published: May 29, 2026
Last Updated: May 29, 2026


Quick Answer: Programming a Tesla Model S Key with LOKI

Programming a new or lost key fob to a Tesla Model S using the LOKI diagnostic tool requires a direct USB connection to the vehicle's OBD-II port (via a CAN bus interface). The process involves putting the car into "Diagnostic Mode" via the center touchscreen, launching the LOKI software, and performing a "Key Add" or "Key Replacement" routine. You will need physical access to the key fob you wish to program. The entire procedure typically takes 10–15 minutes and does not require a Tesla Toolbox subscription.


Why You Might Need to Program a Tesla Model S Key from Scratch

Losing all your Tesla key fobs — or buying a used Model S with only one key — can feel like a major roadblock. Without a working fob, you can't unlock the doors, start the car, or use passive entry. While Tesla service centers can handle this, they often charge a premium and require an appointment. For DIY owners and independent shops, the LOKI Tesla diagnostic tool offers a practical, offline alternative. It gives you the ability to program a key from scratch right in your own garage, saving both time and money.

But is this approach safe? Yes, when done correctly. The LOKI tool communicates directly with the car's Body Control Module (BCM), which manages the immobilizer and key authentication. As long as you follow the steps carefully and have a compatible fob, you can restore full key functionality without any specialized training.


Prerequisites: What You’ll Need Before You Start

Before diving into the programming procedure, gather all necessary hardware and prepare the vehicle state. Missing a single item can cause the process to fail or, worse, corrupt the key memory.

Hardware Requirements

  • LOKI diagnostic tool – Must support CAN bus communication. Most LOKI models (e.g., LOKI OBD2 or LOKI Pro) work for Model S key programming.
  • Windows laptop – The LOKI software only runs on Windows (Windows 7 or newer is fine).
  • USB-to-OBD-II cable – Typically included with the LOKI tool. Ensure it’s firmly connected.
  • New Tesla key fob – Check the FCC ID printed on the back. It must match the revision for your Model S year (e.g., pre-2016 fobs use different hardware than 2016–2021 fobs).

Vehicle State

  • The car must be in Park with the touchscreen powered on.
  • Turn off the HVAC system and audio to reduce battery drain during programming.
  • Keep the 12V battery connected — it supplies power to the diagnostic port and the BCM.

Connection Check

The OBD-II port location varies by year. In early Model S (2012–2016), it’s under the center console near the driver’s right knee. In later models (2017–2021), it’s behind the glovebox. If you can’t find it, consult your owner’s manual or a Model S forum for the exact location.


Step 1: Enter Vehicle Diagnostic Mode

The touchscreen’s hidden diagnostic mode is the gateway for the LOKI tool to talk to the keyless entry system. Here’s how to access it:

  1. On the center touchscreen, tap Controls.
  2. Tap Software.
  3. Press and hold the “Model S” text at the very top of the screen — not the car icon, but the text itself. After about 5 seconds, a password dialog box appears.
  4. Type service (all lowercase) and press Enter.
  5. The screen will now display the Diagnostics menu. You may notice the screen flicker briefly; this is normal as the system switches modes.
  6. Navigate to “TPIS” or “Body Controls” (the exact menu label depends on your firmware version). This section controls the Body Control Module, where key data resides.

Tip: If the text doesn’t respond, try tapping just above or below it. Some firmware versions require a slightly different touch zone.


Step 2: Connect the LOKI Tool and Establish Communication

Now it’s time to wire up the hardware. Follow this order to avoid driver conflicts:

  1. Power off your laptop before plugging in the LOKI USB cable.
  2. Plug the LOKI tool into the vehicle’s OBD-II port. You should hear a click when it’s fully seated.
  3. Connect the LOKI to your laptop via the USB cable.
  4. Power on the laptop and launch the LOKI diagnostic software.
  5. In the software, select “Tesla” as the protocol, then choose the correct Model S profile. For most pre-2021 Model S vehicles, pick “Model S (2012-2021) – MS/PS” .
  6. Click “Connect” . A green indicator should appear, confirming communication with the main CAN bus. If you see a red or yellow indicator, double-check the cable connections and the vehicle’s power state.

Step 3: Select the Key Programming Function

With the tool connected, navigate to the immobilizer section:

  1. In the LOKI software menu, go to “Immobilizer” or “Key Programming” .

  2. You’ll see two main options:

    • Add Key – Use this if you still have at least one working key fob and want to add another.
    • All Keys Lost / Replace All Keys – Choose this if you have zero working keys. This erases all existing key data and lets you start fresh.
  3. Important warning: If you select “All Keys Lost,” every previously enabled key will be erased from the vehicle’s memory. You must have all physical fobs you want to use in your hand before proceeding. There is no undo.


Step 4: Execute the Key Programming Sequence

This is where the magic happens. The car and the tool will work together to link the fob to your Model S.

  1. Place the new key fob inside the vehicle, ideally in the center console cupholder. That’s where the RFID antenna has the strongest signal.
  2. Click “Start” or “Program” in the LOKI software.
  3. The software will run a routine. You’ll hear a chime from the car — this indicates the BCM is listening for the fob.
  4. When prompted on screen: Press the rear trunk open button on the key fob twice. This confirms the fob’s presence and completes the pairing handshake.
  5. The software will display “Key Learned” or “Key Added” .
  6. If you’re programming multiple fobs, repeat step 4 for each one without disconnecting the tool.
  7. Click “Finish” to save all changes to the vehicle’s memory.

Note: If you press the button too early or too late, the software will time out. Stay patient and wait for the on-screen prompt.


Step 5: Exit and Test the New Key

After the programming routine finishes, you need to exit diagnostic mode and verify the key works properly.

  1. Close the LOKI software and disconnect the USB cable. Leave the OBD tool plugged in if you plan to test immediately.
  2. Exit Diagnostics Mode: On the center screen, tap the “X” button in the diagnostic menu, or simply tap “Controls” to return to the main menu.
  3. Perform a hard reset (recommended): Press and hold both scroll wheels on the steering wheel until the center screen turns black and the Tesla logo appears — this takes about 10 seconds. The hard reset ensures the BCM fully reloads the new key data.
  4. Test the key:
    • Walk away from the car (at least 10 feet).
    • Lock the car using the fob.
    • Walk back and check that passive entry works — the door handles should present themselves as you approach.
    • Press the fob’s unlock button from a distance to confirm long-range radio works.

If all tests pass, you’ve successfully programmed the key from scratch.


Troubleshooting Common LOKI Programming Errors

Even with the right preparation, things can go wrong. Here are the most frequent errors and how to fix them.

Error: “Communication Lost” or “CAN Bus Offline”

  • Cause: Loose cable connection or the vehicle entered sleep mode.
  • Fix: Unplug the LOKI from the OBD port, then firmly re-plug it. Make sure the touchscreen is still on and the car hasn’t gone to sleep. If needed, press the brake pedal to wake the CAN bus.

Error: “Key Already Learned” or “System Full”

  • Cause: The fob was previously paired to this car but not erased, or the key memory table is corrupted.
  • Fix: Instead of “Add Key,” use the “Replace All Keys” function to clear the table and start fresh.

Error: “Key Not Detected – Place Key Near Antenna”

  • Cause: Weak fob battery or incorrect placement.
  • Fix: Replace the key fob battery with a fresh CR2032. Place the fob directly on the center console pad (not inside a bag or pocket). Slightly tilting it upright can improve RFID coupling.

Error: “Software Version Not Supported”

  • Cause: A recent Tesla over-the-air (OTA) update may have locked out third-party diagnostic tools.
  • Fix: Update the LOKI software to the latest version from the manufacturer’s website. If the problem persists, you may need to wait for a LOKI firmware patch — these usually arrive within a few weeks after a major Tesla update.

Understanding the LOKI Tool vs. Tesla Toolbox

It’s important to know when to use the LOKI tool versus the official Tesla Toolbox. Here’s a quick comparison:

Feature LOKI Tool Tesla Toolbox
Cost One-time hardware purchase (~$100–$200) Paid subscription (~$100+/hour)
Internet required No – works fully offline Yes – requires constant connection
Supported vehicles Model S/X (pre-2021) – key programming, modules All Tesla models – full factory diagnostics
Key programming Yes – for older Model S/X Yes – for all models, including newer platforms
Limitations Cannot reprogram MCU or HV battery modules Can reprogram everything, but expensive

For owners of a 2012–2020 Model S, the LOKI tool is a practical, budget-friendly option for key fob programming and basic module resets. For newer Model 3/Y or 2021+ Model S (Palladium platform), you’ll still need Tesla Toolbox or a trip to the service center.


Frequently Asked Questions (FAQ)

Can I program a used Tesla key fob from another car?

Yes, but only if you use the “All Keys Lost” procedure. The LOKI tool erases the previous vehicle’s security data and writes a new link to your Model S. The fob must be hardware-compatible (same FCC ID). A fob from a 2015 Model S will not work on a 2020 Model S.

Do I need to disconnect the 12V battery before programming?

No. For key programming via LOKI, you should leave the 12V battery connected. The BCM and touchscreen need power to communicate with the tool. Disconnecting the battery can interrupt the process and corrupt the key memory.

What happens if the LOKI tool loses power mid-programming?

If power is lost during the “Write” phase, the key memory can become corrupted. The car may then refuse to recognize any existing keys. Don’t panic — reconnect the tool and immediately run the “All Keys Lost” procedure. This clears the corrupted table and lets you start fresh.

Can this method program phone keys (Bluetooth/NFC)?

No. The LOKI diagnostic tool only programs physical key fobs (RFID and long-range radio). Phone keys used via the Tesla app (Bluetooth and NFC) are paired directly through the car’s infotainment system, and that process does not require any diagnostic tool.

Is it legal to program my own key?

Yes, for your personal vehicle. However, using a LOKI tool or any diagnostic device to program keys for stolen cars is a felony (theft of services/vehicle). Most tool manufacturers, including LOKI, require proof of VIN ownership for technical support inquiries. Always ensure you have legal ownership before performing key programming.


About the Author: Erwin Salarda is an Automotive Service Equipment Technician based in the Philippines, specializing in computerized automotive diagnostic equipment such as OBD scanners and wheel alignment systems. Since 2012, he has been actively providing technical support, equipment installation, troubleshooting, after-sales service, and hands-on training for automotive service equipment used by workshops and automotive professionals.

He has received specialized training from international suppliers and manufacturers, including Launch X431 in Shenzhen, China, Lawrence Engineering Company in Guangzhou, China, and 3Excel Wheel Alignment Company in Shenzhen, China. Through these trainings, he developed advanced expertise in automotive diagnostics, calibration, wheel alignment systems, and computerized automotive service technologies.

Erwin Salarda provides professional after-sales support and technical training for automotive diagnostic and wheel alignment equipment, helping clients maximize the performance and proper use of their tools and systems. His experience covers equipment setup, software updates, calibration procedures, troubleshooting, and operational guidance for automotive workshops and service centers.

With more than a decade of experience in the automotive equipment industry, Erwin Salarda continues to support automotive businesses by delivering reliable technical expertise and practical training solutions.

For inquiries and equipment purchases, please visit https://carlifterph.com/


Related Posts