The definitive interactive guide to MSG1→MSG4. Step through a live 4-step simulation, decode a real RAR byte-by-byte, race 4-step vs 2-step access, and compute RA-RNTI, Timing Advance and PRACH power — exactly as the specs define them.
The UE selects a random preamble from the set of 64 available preambles and transmits it on the PRACH occasion. The preamble is a Zadoff-Chu sequence (root sequence length 839 for long format, 139 for short). The gNB detects the preamble via correlation and estimates the Timing Advance (TA).
The gNB responds within the RA-Response window (ra-ResponseWindow) on the PDSCH, addressed via RA-RNTI on PDCCH. The RAR contains the Timing Advance Command (11-bit), UL Grant for MSG3 (27-bit), Temporary C-RNTI (16-bit), and backoff indicator if contention is detected.
Using the UL Grant from MSG2 and applying the TA, the UE transmits on PUSCH. Contains the UE's identity: CCCH SDU with RRC Setup Request (5-bit random value + establishment cause) for initial access, or RRC Resume Request (I-RNTI) for connection resumption. HARQ is applied.
The gNB echoes back the UE Identity received in MSG3, transmitted on PDSCH and addressed by TC-RNTI on PDCCH. If the UE identity matches, contention resolution is successful — the TC-RNTI becomes the C-RNTI and the UE is connected. If not, the UE restarts the procedure with backoff.
The Random Access Channel (RACH) procedure establishes initial uplink synchronization between the UE and gNodeB. This simulation walks you through every sub-step with detailed technical context from 3GPP TS 38.321.
Press "Start RACH" then use "Next Step" to walk through at your own pace
UE first detects the Synchronization Signal Block (SSB) and reads the System Information Block 1 (SIB1) which contains RACH-ConfigCommon. From this, the UE determines available PRACH occasions (time slots & frequency resources) mapped to the detected SSB beam index.
UE randomly selects a preamble index from the contention-based (CB) pool. For CBRA, preambles 0-63 are divided into Group A and Group B based on messageSizeGroupA and messagePowerOffsetGroupB. The preamble is a Zadoff-Chu sequence of length 839 (long format) or 139 (short format).
The UE calculates the initial PRACH transmit power using open-loop power control. It measures the downlink path loss from SSB RSRP and adds it to the target preamble received power configured by the network.
The UE transmits the selected preamble on the next available PRACH occasion. The PRACH signal occupies specific time-frequency resources defined by the PRACH format. For Format 0, the preamble duration is 0.8ms + 0.1ms CP (total ~1ms).
After transmitting the preamble, the UE starts monitoring PDCCH for a response addressed to the calculated RA-RNTI. The monitoring window starts at the end of the PRACH preamble transmission, not the beginning.
The gNB's PRACH detector performs correlation with all 64 possible cyclic shifts of each root sequence. When a preamble is detected, the correlation peak timing offset gives the round-trip propagation delay, from which the Timing Advance command is calculated.
The gNB constructs a MAC PDU containing one or more RAR entries. Each RAR entry is 7 bytes and contains the matched preamble's response. Multiple preamble responses can be batched in a single RAR if multiple UEs accessed simultaneously.
The gNB schedules the RAR on PDSCH and signals it via DCI Format 1_0 on PDCCH, scrambled with the RA-RNTI = 15. The UE, which has been monitoring PDCCH since the RA-Response window opened, detects this DCI and reads the PDSCH allocation.
The UE reads the RAR MAC PDU and checks if any RAR entry contains its preamble index (RAPID = 37). If matched, the UE extracts TA Command, UL Grant, and TC-RNTI. If no match within ra-ResponseWindow, the UE retransmits the preamble with powerRampingStep increase.
If the MAC subPDU includes a Backoff Indicator (BI), it means the cell is experiencing high PRACH load. The UE must wait a random time within [0, BI_value] before retransmitting if needed. Common BI values: 5ms, 10ms, 20ms, 40ms, 60ms, 80ms, 120ms, 160ms, 240ms, 320ms, 480ms, 960ms.
The UE decodes the 27-bit UL grant from the RAR to determine PUSCH resources for MSG3. The grant specifies frequency hopping, MCS, time domain allocation, and TPC command. The UE prepares PUSCH transmission according to these parameters.
Before transmitting, the UE applies the Timing Advance received in MSG2. This ensures the UE's uplink signal arrives at the gNB aligned with the slot boundary. The TA compensates for the propagation delay — critical for maintaining uplink orthogonality.
For initial access, the UE constructs an RRC Setup Request message containing the UE's identity and the establishment cause. This is placed in a CCCH (Common Control Channel) SDU. The identity is either a 5-bit random value (first time) or a truncated S-TMSI (if previously registered).
The UE transmits MSG3 on the PUSCH resources with the applied TA. A HARQ process is assigned for MSG3, enabling retransmission if the gNB fails to decode. The gNB acknowledges via PHICH or DCI on PDCCH.
After transmitting MSG3, the UE starts the ra-ContentionResolutionTimer. If MSG4 is not received before this timer expires, the UE considers the RA attempt failed and may restart with a new preamble and power ramp.
The gNB successfully decodes MSG3, extracts the UE identity (CCCH SDU content), and prepares the contention resolution message. The gNB echoes back the exact UE identity received in MSG3 so the UE can verify it was the intended recipient.
Along with contention resolution, the gNB sends an RRC Setup message (or RRC Resume for reconnection). This contains the dedicated radio resource configuration: SRB1 setup, cell group config, and initial BWP parameters.
The gNB schedules MSG4 on PDSCH, signaled via DCI on PDCCH scrambled with the TC-RNTI (0x4A3B). The UE, which has been monitoring PDCCH with TC-RNTI since MSG3, detects and decodes this message.
The UE compares the Contention Resolution Identity in MSG4 with the CCCH SDU it sent in MSG3. If they match, contention resolution is successful. If another UE sent the same preamble and the gNB responded to that UE instead, the identity won't match — contention resolution fails.
Upon successful contention resolution, the TC-RNTI is promoted to C-RNTI — the permanent cell-level identifier for this UE. The UE transitions to RRC_CONNECTED state, applies the received radio configuration, and sets up SRB1 for subsequent signaling.
After RA completion, the UE sends RRCSetupComplete containing the initial NAS message (e.g., Registration Request). The network then proceeds with authentication, security mode, and bearer setup. The RA procedure has served its purpose: the UE is now uplink-synchronized with dedicated resources.
The UE has successfully completed the 4-step RACH procedure and is now in RRC_CONNECTED state with C-RNTI 0x4A3B. All 28 sub-steps covered.
Press "Reset" to restart the simulation or try "Contention-Free" mode
Go deeper into every channel you've seen in this RACH simulation. Our interactive lab covers 85 subtopics across 7 physical channels with step-by-step calculators, 3GPP references, and canvas visualizations — from Zadoff-Chu sequences to DMRS, LDPC coding, and resource mapping.
Explore 5G PHY Layer LabRandom Access is Module 6 of our flagship 5G NR Physical Layer · Advanced course — 99 cinematic, audio-narrated lessons covering every channel and signal in TS 38.211, from numerology and SSB to PDSCH, PUSCH, PRACH and CSI-RS.
Explore the full coursessb-perRACH-OccasionAndCB-PreamblesPerSSB.
powerRampingStep (2dB) and retransmits with a new preamble. Shows power ramping across multiple attempts.
| Format | SCS | Sequence | CP length | Total duration | Max cell radius | Typical use |
|---|---|---|---|---|---|---|
| 0 | 1.25 kHz | 1 × 800 µs | 103.1 µs | ≈ 1.0 ms | ~14.5 km | LTE-refarmed macro cells, classic coverage |
| 1 | 1.25 kHz | 2 × 800 µs | 684.4 µs | ≈ 3.0 ms | ~100.2 km | Very large / rural / maritime cells |
| 2 | 1.25 kHz | 4 × 800 µs | 152.6 µs | ≈ 3.5 ms | ~22.1 km | Coverage extension via repetition gain (+6 dB) |
| 3 | 5 kHz | 4 × 200 µs | 103.1 µs | ≈ 1.0 ms | ~14.5 km | High-speed UEs (≤ 500 km/h) — wider SCS resists Doppler |
| Format | OFDM symbols | CP (κ units) | Max cell radius | Typical use |
|---|---|---|---|---|
| A1 | 2 | 288·2−µ | 0.94 km | Small cells, dense urban |
| A2 | 4 | 576·2−µ | 2.11 km | Normal urban cells |
| A3 | 6 | 864·2−µ | 3.52 km | Suburban, the common FR1 TDD default |
| B1 | 2 | 216·2−µ | 0.59 km | Indoor / hotspot — shortest format |
| B2 | 4 | 360·2−µ | 1.05 km | Combined as A2/B2 in config tables |
| B3 | 6 | 504·2−µ | 1.76 km | Combined as A3/B3 in config tables |
| B4 | 12 | 936·2−µ | 3.87 km | Beam sweeping with many repetitions (FR2) |
| C0 | 1 | 1240·2−µ | 5.35 km | Single-symbol with generous CP |
| C2 | 4 | 2048·2−µ | 9.30 km | Largest short-format radius |
Rule of thumb: cell radius ≈ (CP − max delay spread) × c / 2. The preamble must arrive inside the CP window for the gNB correlator to detect it without inter-symbol interference.
| Information Element | Range | What it controls |
|---|---|---|
| prach-ConfigurationIndex | 0…255 | Selects preamble format + which frames/subframes/slots contain PRACH occasions (TS 38.211 Tables 6.3.3.2-2/3/4) |
| msg1-FDM | 1 / 2 / 4 / 8 | Number of frequency-multiplexed PRACH occasions per time instance |
| msg1-FrequencyStart | 0…274 | Lowest PRB of the first PRACH occasion, relative to PRB 0 of the UL BWP |
| prach-RootSequenceIndex | 0…837 / 0…137 | Logical Zadoff-Chu root the cell starts from; consecutive roots are consumed until 64 preambles are generated |
| zeroCorrelationZoneConfig | 0…15 | NCS — cyclic-shift spacing between preambles. Larger NCS = larger cell radius but fewer preambles per root |
| preambleReceivedTargetPower | −202…−60 dBm | Power the gNB wants to receive MSG1 at — anchor of the open-loop power control formula |
| powerRampingStep | 0/2/4/6 dB | Increment added after each failed preamble attempt |
| preambleTransMax | n3…n200 | Max preamble attempts before the UE declares RACH failure to RRC |
| ra-ResponseWindow | sl1…sl80 | How long the UE monitors PDCCH (RA-RNTI) for the RAR after MSG1 |
| ssb-perRACH-OccasionAndCB-PreamblesPerSSB | 1/8…16 | Maps SSB beams → RACH occasions and splits the 64 preambles per SSB; this is how the gNB learns your best beam from MSG1 alone |
| ra-ContentionResolutionTimer | sf8…sf64 | How long the UE waits for MSG4 contention resolution after sending MSG3 |
| rsrp-ThresholdSSB | 0…127 | Minimum SSB RSRP for a beam to be selectable for RACH |
| restrictedSetConfig | unrestricted / typeA / typeB | Restricted preamble sets for high-speed cells (Doppler-shifted correlation peaks) |
| msg3-transformPrecoder | enabled / absent | DFT-s-OFDM for MSG3 — lower PAPR for cell-edge UEs |
The very first thing a phone does on a 5G cell after reading SIB1 — no uplink timing exists yet.
Recovering from radio link failure — the UE must re-acquire UL sync before it can tell the network what happened.
Arriving at the target cell. Usually contention-free: the target gNB pre-allocates a dedicated preamble in the HO command.
Data arrives for you but your timing-advance timer expired — the gNB orders RACH via PDCCH (contention-free).
You have data to send but lost sync, or have no PUCCH resources for a Scheduling Request.
Scheduling Requests exhausted (sr-TransMax reached) with no grant — RACH is the fallback.
Resuming a suspended connection — MSG3 carries RRCResumeRequest with the I-RNTI.
All serving-beam candidates failed; the UE RACHes on the occasion mapped to a new candidate beam (Rel-15 BFR).
Requesting an SIB the cell doesn't broadcast — MSG1-based or MSG3-based SI request.
UL time-alignment needed for positioning measurements (Rel-16).
Everything you've explored here — PRACH preambles, Zadoff-Chu sequences, resource grids, TA estimation, power control — is covered in depth in our interactive lab. Each topic has visual calculators, animated diagrams, and direct 3GPP TS references. Ideal for developers, testers, and optimization engineers.
Everything on this page — preamble design, RA-RNTI, beam-mapped occasions, MSG3 precoding — is taught in full cinematic depth in our flagship 5G NR Physical Layer · Advanced course: 99 animated, audio-narrated lessons engineered straight from TS 38.211–38.214. No fluff, no hand-waving — the same rigor as this tool, across every channel and signal.
Physical channels and modulation — PRACH signal generation, preamble sequence, time-frequency structure
Physical layer procedures — PRACH occasions, power control, RA-RNTI, Timing Advance
MAC specification — Random Access procedure, RAR parsing, contention resolution, backoff
RRC specification — RACH-ConfigCommon, RACH-ConfigDedicated, BWP configuration for RA