The history of the North British Railway until 1855 traces the founding and construction of the railway company. It built and opened its line between Edinburgh and Berwick (later Berwick on Tweed) and formed part of the first rail link between Edinburgh and London (although with two water breaks). The line opened in 1846.

The first chairman, John Learmonth, wanted to enlarge the geographical area of dominance of the NBR and committed huge sums of money to the project even before opening the first line. Some of the commitments were in vain, but he acquired the Edinburgh and Hawick Railway as a first step to reaching Carlisle, part of the bitter and enduring rivalry with the Caledonian Railway. Making the Hawick line included purchasing the obsolescent Edinburgh and Dalkeith Railway and converting it for locomotive operation.

The railway's operations were popular and successful, although early shortcomings in the civil engineering caused temporary difficulties. Branches to Haddington, North Berwick, Dunse (later spelt Duns) and Kelso were opened. Part of the motivation for their building was the exclusion of rival railway companies, and these branches did not enjoy such great success.

The drain on the Company's financial resources dragged it down in comparison to the rival Caledonian Railway, and shareholder dissent led to the departure of its first chairman and his successor, and in 1855 Richard Hodgson took over, with the mandate of rescuing the company.

Early railways The Lothian and Fife areas of Scotland had been endowed with minerals, especially coal that led to adoption of waggonways as a means of transport in the eighteenth century. These early lines used horse traction and wooden rails, and in nearly all cases were designed to convey coal and limestone over short distances to a harbour for onward transport. In the nineteenth century, the notion of longer distance lines began to take hold, but for the time being available technology prevented that idea becoming a practicable proposition.

In the first years of the nineteenth century, the use of iron rails became commonplace, and it was possible to think in terms of trains, rather than two or three wagons, and primitive locomotives came into use. The so-called coal railways of the Monklands were starting to adopt steam traction, and also to carry passengers in some cases. The Monkland and Kirkintilloch Railway of 1825 and the Garnkirk and Glasgow Railway 1831 were pioneers.

It was the opening of the Stockton and Darlington Railway in 1825 which indicated that technological progress could make a successful railway over longer distances using locomotive power, and the Liverpool and Manchester Railway of 1830 showed that an inter-city steam railway could be viable. Indeed, the success of the passenger part of the L&MR operation seems to have taken everyone by surprise. When the London and Birmingham Railway opened, followed by the Grand Junction Railway of 1833, connecting Birmingham with the Liverpool and Manchester line, the notion of a railway network began to take hold, and suddenly it seemed as if the whole of Great Britain must be connected into it.

Longer distance railways The first long-distance line in Scotland was the Edinburgh and Glasgow Railway, opening in 1842, and this too was commercially successful beyond the expectations of its promoters. The E&GR had been built to the track gauge of inches, whereas most of the earlier Scottish lines had been built with a gauge of . Although at that time interconnection with English railways was not yet considered, the selection must have been influenced by the perceived technical superiority of the Stockton and Darlington and its imitators.

If English railways seemed to be congregating in the Midlands and North of England, and slowly progressing northwards, then perhaps Scottish railways needed to be promoted to extend southward to join them. As the money market became freer as the 1830s moved on, a number of proposals were put forward for connecting central Scotland with the English network. (In addition, many schemes were promoted for domestic Scottish lines, but the controversy was not so intense for them.)

Suddenly the newspapers were full of commentary about the line to England, with wild schemes being praised by their promoters and condemned by their opponents. For the time being it was assumed that only a single route could be commercially viable to handle all the traffic. It was critical to design a route that could cross the high ground of the Southern Uplands and the Cheviot Hills and the Pennines, usable by the technically primitive locomotives of the day, which were unable to ascend steep and lengthy gradients. In 1835 the Grand Junction Railway, already planning to reach Preston and later Carlisle, commissioned the young engineer Joseph Locke to propose routes from Glasgow to Carlisle. His report made the difficulties plain: a west coast route (as the Carlisle options were beginning to be called) had to ascend steep gradients or go in a wide westerly circuit round them. The Grand Junction investors had other preoccupations further south and the idea was deferred for the time being.

More modest schemes were being proposed, though, and in 1836 plans for a line from Edinburgh to Dunbar by way of Haddington had been prepared. In the same year a line from Edinburgh through Jedburgh and under Carter Fell to Newcastle upon Tyne was put forward, but neither of these schemes was progressed further. However, on 24 October 1838 a Great Northern Junction Railway was proposed by a meeting of promoters; this time the line would run through Berwick. Work was done on route design, by George Stephenson, who found that gradients and engineering works would be much easier than going over the flank of the Southern Uplands. In February 1839 a prospectus was issued; the name had been changed to the Great North British Railway. The capital required for the scheme was £2 million.

The Smith-Barlow Commission The considerable public interest continued, and the Government decided that the matter should be decided in the national interest. In 1840 it appointed a commission to advise it, and Professor Peter Barlow of the Royal Military Academy, Woolwich, and Colonel Sir Frederick Smith, Inspector General of Railways at the Board of Trade, were appointed to "make recommendations on the most effective means of railway communication from London to Edinburgh, Glasgow and Dublin". In fact, a major part of their consideration was a route from Glasgow and Edinburgh to Carlisle or Newcastle. Both of the English places already had definite schemes in hand to place them on the English network, so the gap lay in southern Scotland, and Dublin was not a central issue.

The Commission considered 16 schemes, although many of them were no more than minor variations of others. In several cases the promoters of schemes were unable to provide more than the most basic details of their proposals and their costs, and the Commissioners found wild and inexplicable variations in unit costs assumed.

Their report was published on 15 March 1841: they repeated the assumption that only one line was required linking Scotland and England. The Annandale route to Carlisle via Beattock was favoured. Although the gradients would be challenging, the route had the advantage of being reasonably direct, and serving both Glasgow and Edinburgh equally well. Importantly, their recommendation was heavily qualified: anyone could build such a line provided they gave an undertaking to reach Lancaster, which at that time was the northern extremity of planned English railways. If this undertaking were not given, an east coast route via Newcastle would have preference. This ambiguity was fatal to the authority of their report.

There were two further fundamental shortcomings in their recommendation: it was not mandatory; and there was no Government money on offer to build the recommended line. Most people had assumed that public money would be made available to build the preferred route; the sudden tightness of the commercial money market ensured that no group of promoters rushed to do the Commission's bidding.

The passage of time had changed attitudes to railway speculation; the success of the first inter-city railways and the further success of local feeders and secondary routes, encouraged the belief that there could be more than one route to England, and in fact that any route could be viable on its own terms. The Commission's findings had become irrelevant.

The North British Railway takes shape Nonetheless the start of the Commission's work, coupled with an extreme tightness of the money market, had put paid to the immediate prospect of the £2 million Great North British Railway. In January 1842 John Learmonth, chairman of the Edinburgh Committee of the Edinburgh and Glasgow Railway, chaired a meeting proposing a more modest scheme from Edinburgh to Dunbar only. They obtained the surveys of the Great North British Railway and intended to follow the same route as far as Dunbar; and they determined to call their line the North British Railway. A prospectus was issued in February 1842; there was to be a branch to Haddington, and the capital was to be £500,000. Haddington, a Royal Burgh and important county market town was displeased to be on a branch line; the earlier proposals had put it on the main line. Learmonth was anxious to keep the capital cost under control, and routing through Haddington would have materially increased capital cost and running cost due to the more difficult terrain. Dunbar too was disappointed to find that its terminus was to be south of the town, and not connecting its important fishing harbour; here the reason was the intended later extension to Berwick: Learmonth had a clear vision that Dunbar was only a short-term terminus; the station needed to enable a later extension.

The track gauge too was now determined not by local whim, but by the imperative of joining up with the English network; the notion of a "standard gauge" of 4 ft in was taking hold.

There was now a sense of urgency about raising money, for the provisional Caledonian Railway was also planning its future line and trying to raise money. Quite apart from the now discredited idea of only one line being viable, the capital required for a long distance railway was huge, and the gross available capital was not unlimited. Already the rivalry for supremacy between the North British Railway and the Caledonian Railway was in action. In fact, both lines found that they could not raise enough money to go to Parliament in the 1843 session as they had hoped.

A revised route with steeper gradients had been considered earlier, in an attempt to reduce construction costs by 8%, and further cost-paring might have been attempted at this stage. Now Learmonth was persuaded by George Hudson, an English railway promoter and financier, to increase interest in his scheme by putting forward a more ambitious scheme, going all the way to Berwick (later known as Berwick-upon-Tweed. At 56 miles, this would increase construction costs to £900,000, but be more attractive to investors: it would link with the proposed Newcastle and Berwick Railway and form part of a future chain of railways reaching London. Hudson agreed to subscribe £50,000, and he did so in due course, although he then passed his holding to the York and North Midland Railway, which he controlled. The railway engineer John Miller was asked to revisit the route surveys to reduce cost, and he did so, getting the cost of construction down to £800,000, though this figure omitted the acquisition of coaching stock. The Edinburgh terminus was altered to be at North Bridge, having previously been intended at Leith Walk.

The act secured