Using an ultrasonography, a fetal heartbeat can be first detected as early as 5½ to 6 weeks after gestation. But after 6½ to 7 weeks after gestation, a heartbeat can be better assessed.