Pick the state and the city, preview it live and copy a single line of code to show today's sunrise and sunset on your website, blog or online store, updated every day. It works for any of Brazil's 5,571 municipalities.
1. Set up the widget
2. Preview it
3. Copy the code
nofollow, and it is what keeps the widget free: it must not be removed, hidden or covered. By using the code you agree to keep it visible. What the widget shows
The widget is a compact box with the city name and today's date, the time of sunrise and sunset in large figures and, if you tick the options, the day length, the morning and evening golden hour (the soft, warm light that photographers and filmmakers look for) and the Moon phase. All times are shown in the city's own local time, so a visitor in Lisbon or Tokyo sees the same numbers as someone standing in the city.
The times are calculated on our server with the same astronomical method used on every sunrise and sunset page of the site, and the date is part of the page. When the day changes the widget asks the server for the new numbers by itself. If JavaScript is disabled, the box still shows the last calculated times.
Who it is for
- Tourism, hotels and guesthouses: tell guests when to catch the sunset on the beach, at the lookout or on the farm.
- Photography and drone blogs: plan shoots around the golden hour.
- Farms, fishing, surf and outdoor sports: daylight hours decide the working day.
- Local news, city portals and schools: a useful daily box for the sidebar.
- Religious and cultural sites: practices tied to dawn and dusk.
How to add it to your website
- Choose the state and the city above, then theme, size and options. The preview and the code update at each change.
- Click "Copy code". It is a single
<iframe>tag: nothing to install, and no script to load on your own page. - Paste it where the box should appear: sidebar, footer, a page about the city or a blog post.
WordPress
In the block editor, add a Custom HTML block and paste the code. For a sidebar or footer, go to Appearance > Widgets and add a Custom HTML widget (on block themes, use Appearance > Editor). In the classic editor, switch to the Text tab before pasting; the visual tab may strip the tag.
Wix, Squarespace, Blogger, Google Sites and Shopify
Wix: Add Elements > Embed Code > Embed HTML. Squarespace: a Code block. Blogger: Layout > Add a Gadget > HTML/JavaScript. Google Sites: Insert > Embed > Embed code. Shopify: a Custom Liquid section. Some free plans restrict custom HTML, so check that yours accepts iframes.
Make it responsive
The content scales with the iframe, so let the iframe scale: wrap it in a container with a maximum width and use width:100%, keeping the height proportional (about 35% of the width, a little more with the extra lines).
Customize through the address
| Parameter | Values | What it does |
|---|---|---|
uf | two letters, e.g. sp | State. Invalid values fall back to São Paulo. |
city | slug, e.g. campinas | City, as in the address of its page. Invalid values fall back to São Paulo, SP. |
theme | light, dark, transparent | Colors of the box. |
color | hex, e.g. ffffff | Text color for the transparent theme. |
size | sm, md, lg | Scale of the text inside the iframe. |
len, gold, moon | 1 or 0 | Show day length, golden hour and Moon phase. |
lang | pt or en | Language of the labels, of the date and of the credit link. |
Attribution link and privacy
The link is part of the deal. The widget is free because it carries a small "Brasília Time" link to this site. It is an ordinary link, not marked nofollow, and it must stay visible: hiding it, making it transparent, shrinking it to an unreadable size or covering it with other elements is not allowed.
No cookies, no tracking. The widget page sets no cookies, shows no ads, loads no analytics and is not indexed by search engines. The only thing that happens is the usual request the visitor's browser makes to load the iframe.
Related tools
- Clock widget: a live clock for any time zone, with the same kind of embed code.
- Sunrise and sunset by state, city and country: full tables, twilight and the next 7 days.
- Sunrise and sunset rankings: earliest and latest Sun, longest and shortest days.