Visitors need to pre-register for the free tickets for Saturday, December 1, and Sunday, December 2.
Across the country, more than 40 top heritage attractions will be giving away thousands of free tickets as part of the Historic Scotland scheme. Edinburgh Castle will have a limit of 5000 tickets.
Other Lothians attractions taking part include Blackness Castle, Craigmillar Castle, Dirleton Castle and Tantallon Castle.
Culture Secretary Fiona Hyslop said: “This is a great opportunity for people to get out and about and explore their heritage.”
Edinburgh Castle will once again be free to walk up visitors on Friday November 30 to give visitors the opportunity to view the Honours of Scotland and the Stone of Destiny on Scotland’s national day.
But for December 1 and 2, visitors need to register in advance at a special website – www.ticketgiveaway.co.uk – in order to download a free ticket.
The giveaway is part of the Scottish Government’s Winter Festivals programme.