CubeSats are a class of spacecraft based on a standardised small size and modular use of off-the-shelf technologies.
Several such CubeSats have been made by university students and dozens have been launched into Earth orbit using extra payload mass available on launches of larger spacecraft.
If the flyby demonstration is successful, the technology will provide Nasa the ability to quickly transmit status information about the main spacecraft after it lands on Mars, the US space agency said in a statement.
The twin communications-relay CubeSats, being built by Nasa's Jet Propulsion Laboratory (JPL), Pasadena, California, constitute a technology demonstration called Mars Cube One (MarCO).
MarCO will launch in March 2016 on the same United Launch Alliance Atlas V rocket as Nasa's InSight (Interior Exploration using Seismic Investigations, Geodesy and Heat Transport) lander.
Insight is Nasa's first mission to understand the interior structure of the Red Planet.
MarCO will fly by Mars while InSight will land on Mars in September 2016.
"MarCO is an experimental capability that has been added to the InSight mission, but is not needed for mission success," said Jim Green, director of Nasa's planetary science division at the agency's headquarters in Washington, DC.
MarCO will fly independently to Mars, he added.
The two CubeSats will separate from the Atlas V booster after launch and travel along their own trajectories to the Red Planet.
After release from the launch vehicle, MarCO's first challenges are to deploy two radio antennas and two solar panels.
MarCO will be navigated to Mars independently of the InSight spacecraft with its own course adjustments on the way.Ultimately, if the MarCO demonstration mission succeeds, it could allow for a "bring-your-own" communications relay option for use by future Mars missions in the critical few minutes between Martian atmospheric entry and touchdown.