According to Luke 3:1, John the Baptist began his ministry in the 15th year of Tiberius Caesar’s reign. Tiberius was appointed as co-regent with Augustus in AD 11, and 15 years later would be AD 26. Jesus began His ministry shortly thereafter at approximately the age of thirty (Luke 3:23). This gives us a basis upon which we can approximate what year Jesus began His public ministry: around AD 26. As for the end of His ministry, we know that it culminated with His crucifixion, resurrection, and ascension.
According to John’s Gospel, Jesus attended at least three annual Feasts of Passover through the course of His ministry: one in John 2:13, another in 6:4, and then the Passover of His crucifixion in 11:55–57. Just based on that information, Jesus’ ministry lasted 2 years, at the very least.
Because of the amount of things that Jesus accomplished and the places He traveled during His ministry, many scholars believe there was another Passover, not mentioned in the Gospels, which fell between the Passovers of John 2 and John 6. This would lengthen Jesus’ ministry to at least 3 years.
We can add more time because of all that took place before the first Passover of Jesus’ ministry in John 2. By the time of that first Passover (in the spring of 27), Jesus had already traveled from the area of the Jordan to Cana to Capernaum to Jerusalem. He had been baptized by John (Matthew 3:13–17), been tempted in the wilderness (Matthew 4:1–2), began His preaching ministry (Matthew 4:17), called His first disciples (John 1:35–51), performed His first miracle (John 2:1–11), and made a trip to Capernaum with His family (John 2:12). All this would have taken several months, at least.
Add to that the 40 days between Jesus’ resurrection and His ascension (Acts 1:3), and we have a total length of Jesus’ earthly ministry. From His baptism to His ascension, the late summer of 26 to the spring of 30, we have approximately 3½ years.