Skip to content
5G/6G Academy
5G/6G AcademyTelecom certifications · since 2009

5G Random Access Simulator

Walk through the 4-step contention-based Random Access procedure on 5G NR, message by message, with RA-RNTI computation, TA command, TC-RNTI and contention resolution identity — per 3GPP TS 38.321 §5.1 and TS 38.213 §8.

L=139, SCS=15 kHz — Short format, small cells (FR1/FR2)

MSG1
MSG2
MSG3
MSG4
UE→gNBgNB→UEUE→gNBgNB→UE
Step 1 / 4
UE
gNB
MSG1
MSG2
MSG3
MSG4
MSG1UE gNBPreamble (PRACH)
ChannelPRACH (physical random access channel)
Preamble index (ra-PreambleIndex)23 / 63
Preamble formatFormat A1
Sequence length (L_RA)139
PRACH SCS15 kHz
Max cell radius~0.94 km
RA-RNTI formula1 + s_id + 14·t_id + 14·80·f_id + 14·80·8·ul_carrier_id
RA-RNTI (with s_id=t_id=f_id=0)1 (0x1)

About 5G Random Access

Random Access (RACH) is how a UE establishes uplink synchronization with a gNB. It happens at initial access, after long DRX, on handover, after radio-link failure, or when the UE has uplink data but no PUCCH resources. 5G NR defines a 4-step contention-based procedure (MSG1–MSG4) and also an optional 2-step procedure (MSGA / MSGB) introduced in Rel-16.

MSG1 is a Zadoff–Chu sequence preamble on PRACH. The gNB detects the preamble and replies with MSG2 (the RAR) scheduled with a DCI 1_0 scrambled by RA-RNTI. The RAR carries the Timing Advance command, an UL grant, and a temporary C-RNTI (TC-RNTI). The UE then sends MSG3 on the granted PUSCH — typically carrying an RRC Setup Request with a 39-bit 5G-S-TMSI or a random identity. Finally MSG4 echoes back the 48-bit UE Contention Resolution Identity MAC CE and carries RRCSetup, promoting TC-RNTI to C-RNTI and moving the UE into RRC_CONNECTED.

Who uses this simulator?

Protocol engineers use it to trace failure points (preamble collision, RAR miss, MSG3 loss, contention resolution timeout). Trainers use it in 5G certification courses. Test engineers use the RA-RNTI formula and RAPID matching to correlate log captures with over-the-air preambles.

Related tools

How to use the 5G Random Access Simulator

  1. Set the preamble index. Type a ra-PreambleIndex from 0 to 63 — the value flows into the RAPID echoed in MSG2 and into the derived TC-RNTI and contention identity.
  2. Pick a preamble format. Choose a format (0, A1–A3, B1/B4, C0/C2); the panel updates the sequence length, PRACH subcarrier spacing and the rough maximum cell radius that format supports.
  3. Step through the messages. Use Next step to advance MSG1 → MSG2 → MSG3 → MSG4, or hit Auto-play to let it cycle on a timer.
  4. Read the per-message fields. For each step, inspect the table of channels, RNTIs, the TA command and the identities so you can map a log capture to the right message.
  5. Reset and try a collision case. Hit Reset, then re-run with a different preamble index to see how the RAPID and contention identity change.

Frequently asked questions

What are the 4 steps of 5G RACH?
Four-step contention-based random access is MSG1 to MSG4. MSG1 is a PRACH preamble the UE picks at random; MSG2 is the Random Access Response (RAR) the gNB sends on PDSCH, scheduled by a DCI scrambled with the RA-RNTI; MSG3 is the UE’s first scheduled PUSCH transmission, usually carrying an RRC Setup Request; MSG4 is contention resolution plus the RRC Setup that promotes the TC-RNTI to a C-RNTI.
What is the RA-RNTI and how is it computed?
The RA-RNTI is the identity the UE uses to find its RAR on PDCCH. It is derived purely from where the preamble was sent in time and frequency: RA-RNTI = 1 + s_id + 14·t_id + 14·80·f_id + 14·80·8·ul_carrier_id, where s_id is the first OFDM symbol of the PRACH occasion, t_id the first slot, f_id the frequency-domain occasion, and ul_carrier_id flags the SUL carrier. Two UEs that pick different preambles in the same occasion share the same RA-RNTI but are told apart by the RAPID inside the RAR.
What is contention resolution in MSG4?
When several UEs choose the same preamble in the same occasion they all read the same RAR and transmit MSG3 on the same grant. MSG4 settles the tie: the gNB echoes the 48-bit UE Contention Resolution Identity MAC CE, which is the leading bits of the CCCH SDU the winning UE sent in MSG3. A UE that sees its own identity considers itself the winner and moves to RRC_CONNECTED; the others back off and restart RACH.
When does a 5G UE trigger random access?
At initial access from RRC_IDLE, on RRC re-establishment after radio-link failure, at handover (where the target cell can hand the UE a dedicated preamble for contention-free access), on transition out of RRC_INACTIVE, when uplink data arrives but the UE has no valid PUCCH resource for a scheduling request, and to re-establish uplink synchronisation when the timing-advance timer expires.

Get the next 5G/LTE engineering deep-dive in your inbox

These calculators give you the number — the weekly digest gives you the theory. One technical breakdown every Tuesday, plus first access to new tools. Unsubscribe in one click.

7-Day Free Trial

Calculator gave you the answer? Learn the theory in 7 days, free.

Full Pro access — 142+ hands-on exercises, 20+ troubleshooting scenarios, 21 certifications, TelcoMentor AI coach. No credit card. See pricing on /pricing.

  • No credit card
  • Full Pro access
  • 21 verifiable certs
  • TELCOMA since 2009
Start My 7-Day Trial